Documentation ¶
Index ¶
- Constants
- Variables
- func BoolPointer(b bool) *bool
- func ConvertStringToActivityType(in string) discordgo.ActivityType
- func ErrorEmbed(ctx dgc.Ctx, err error) *discordgo.MessageEmbed
- func ErrorHandler(err error) error
- func FetchMember(s DataOutlet, guildID, resolvable string, ...) (*discordgo.Member, error)
- func FindNamedSubmatchMap(re *regexp.Regexp, s string) map[string]string
- func GenerateEmbed(ctx dgc.Ctx, e discordgo.MessageEmbed) *discordgo.MessageEmbed
- func GetAstralIdFromUser(s *discordgo.Session, user string, db db.SupabaseMiddleware) (string, error)
- func GetSortedMemberRoles(s *discordgo.Session, guildID, memberID string, reversed bool, ...) ([]*discordgo.Role, error)
- func GetUserFromAstralId(s *discordgo.Session, id string, db db.SupabaseMiddleware) (*discordgo.User, error)
- func Int64Pointer(i int64) *int64
- func IntPointer(i int) *int
- func IsAdmin(g *discordgo.Guild, m *discordgo.Member) bool
- func NowAddPtr(d time.Duration) time.Time
- func ParseDuration(s string) (time.Duration, error)
- func SortRoles(r []*discordgo.Role, reversed bool)
- func StringInSlice(a string, list []string) bool
- func WithCustomRatelimit(cmd *dgc.Command, ratelimit int64) *dgc.Command
- type Child
- type DataOutlet
- type Gildings
- type IBlacklist
- type IBot
- type IBotActivity
- type IBotAnalytics
- type IBotCommand
- type IBotModule
- type IBotModules
- type IBotSettings
- type IDiscordApiUser
- type IIdentityData
- type IIntegration
- type IIntegrationSchema
- type IIntegrationSchemaInput
- type IPermissions
- type IPlan
- type IProfile
- type IProvider
- type IRegion
- type IRobloxIntegration
- type IRobloxIntegrationBadActorDetection
- type IRobloxIntegrationMemberCounter
- type IRobloxIntegrationShoutProxy
- type IRobloxIntegrationWallFilter
- type IRobloxSchema
- type IRobloxSchemaBadActorDetection
- type IRobloxSchemaFactors
- type IRobloxSchemaMemberCounter
- type IRobloxSchemaShoutProxy
- type IRobloxSchemaWallFilter
- type IStatistic
- type ITeamMember
- type ITeamMemberUser
- type IWorkspace
- type IWorkspaceIntegration
- type IWorkspaceMember
- type IWorkspaceMemberWithoutProfile
- type Image
- type MemoryUsage
- type OrderedMap
- type Preview
- type RealtimeOptions
- type RealtimePayload
- type RedditPost
- type RedditPostData
- type RedditResponse
- type RedditResponseElement
- type Response
- type Source
- type Subreddit
Constants ¶
View Source
const ( CategoryBot = "Bot" CategoryFun = "Fun" CategoryImage = "Image" CategoryMusic = "Music" CategoryModeration = "Moderation" CategoryOwner = "Owner" CategoryUtils = "Utils" CategoryVoice = "Voice" CategoryWeb = "Web" )
Variables ¶
View Source
var ( RoleCheckFuncs = []func(*discordgo.Role, string) bool{ func(r *discordgo.Role, resolvable string) bool { return r.ID == resolvable }, func(r *discordgo.Role, resolvable string) bool { return r.Name == resolvable }, func(r *discordgo.Role, resolvable string) bool { return strings.ToLower(r.Name) == strings.ToLower(resolvable) }, func(r *discordgo.Role, resolvable string) bool { return strings.HasPrefix(strings.ToLower(r.Name), strings.ToLower(resolvable)) }, func(r *discordgo.Role, resolvable string) bool { return strings.Contains(strings.ToLower(r.Name), strings.ToLower(resolvable)) }, } MemberCheckFuncs = []func(*discordgo.Member, string) bool{ func(r *discordgo.Member, resolvable string) bool { return r.User.ID == resolvable }, func(r *discordgo.Member, resolvable string) bool { return r.User.Username == resolvable }, func(r *discordgo.Member, resolvable string) bool { return strings.ToLower(r.User.Username) == strings.ToLower(resolvable) }, func(r *discordgo.Member, resolvable string) bool { return strings.HasPrefix(strings.ToLower(r.User.Username), strings.ToLower(resolvable)) }, func(r *discordgo.Member, resolvable string) bool { return strings.Contains(strings.ToLower(r.User.Username), strings.ToLower(resolvable)) }, func(r *discordgo.Member, resolvable string) bool { return r.Nick == resolvable }, func(r *discordgo.Member, resolvable string) bool { return r.Nick != "" && strings.ToLower(r.Nick) == strings.ToLower(resolvable) }, func(r *discordgo.Member, resolvable string) bool { return r.Nick != "" && strings.HasPrefix(strings.ToLower(r.Nick), strings.ToLower(resolvable)) }, func(r *discordgo.Member, resolvable string) bool { return r.Nick != "" && strings.Contains(strings.ToLower(r.Nick), strings.ToLower(resolvable)) }, } ChannelCheckFuncs = []func(*discordgo.Channel, string) bool{ func(r *discordgo.Channel, resolvable string) bool { return r.ID == resolvable }, func(r *discordgo.Channel, resolvable string) bool { l := len(resolvable) return l > 3 && r.ID == resolvable[2:l-1] }, func(r *discordgo.Channel, resolvable string) bool { return r.Name == resolvable }, func(r *discordgo.Channel, resolvable string) bool { return strings.ToLower(r.Name) == strings.ToLower(resolvable) }, func(r *discordgo.Channel, resolvable string) bool { return strings.HasPrefix(strings.ToLower(r.Name), strings.ToLower(resolvable)) }, func(r *discordgo.Channel, resolvable string) bool { return strings.Contains(strings.ToLower(r.Name), strings.ToLower(resolvable)) }, } )
View Source
var (
ErrInvalidDurationFormat = errors.New("invalid duration format")
)
Functions ¶
func BoolPointer ¶
func ConvertStringToActivityType ¶
func ConvertStringToActivityType(in string) discordgo.ActivityType
func ErrorEmbed ¶
func ErrorEmbed(ctx dgc.Ctx, err error) *discordgo.MessageEmbed
func ErrorHandler ¶
func FetchMember ¶
func FetchMember(s DataOutlet, guildID, resolvable string, condition ...func(*discordgo.Member) bool) (*discordgo.Member, error)
FetchMember tries to fetch a member on the specified guild by given resolvable and returns this member, when found. You can pass a condition function which ignores the result if this functions returns false on the given object. If no object was found, ErrNotFound is returned. If any other unexpected error occurs during fetching, this error is returned as well.
func FindNamedSubmatchMap ¶
func GenerateEmbed ¶
func GenerateEmbed(ctx dgc.Ctx, e discordgo.MessageEmbed) *discordgo.MessageEmbed
func GetAstralIdFromUser ¶
func GetSortedMemberRoles ¶
func GetUserFromAstralId ¶
func Int64Pointer ¶
func IntPointer ¶
func IsAdmin ¶
IsAdmin returns true if one of the members roles has admin (0x8) permissions on the passed guild.
func StringInSlice ¶
Types ¶
type Child ¶
type Child struct { Kind string `json:"kind"` Data RedditPost `json:"data"` }
type DataOutlet ¶
type IBlacklist ¶
type IBlacklist struct { ID int8 `json:"id"` CreatedAt time.Time `json:"created_at"` Moderator string `json:"moderator"` User string `json:"user"` DiscordID string `json:"discord_id"` Reason string `json:"reason"` Expires bool `json:"expires"` Expiry time.Time `json:"expiry"` Flags interface{} `json:"flags"` FactorMatching []string `json:"factor_matching"` Notes string `json:"notes"` }
type IBot ¶
type IBot struct { ID *string `json:"id,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Region string `json:"region" form:"region"` Owner *string `json:"owner,omitempty"` Workspace *string `json:"workspace,omitempty"` Settings IBotSettings `json:"settings" form:"settings"` Token string `json:"token" form:"token"` Commands []IBotCommand `json:"commands" form:"commands"` Permissions IPermissions `json:"permissions" form:"permissions"` }
type IBotActivity ¶
type IBotAnalytics ¶
type IBotCommand ¶
type IBotModule ¶
type IBotModules ¶
type IBotModules struct { Fun IBotModule[any] `json:"fun"` Moderation IBotModule[struct { Logging struct { Enabled bool `json:"enabled"` Channel string `json:"channel"` } `json:"logging"` }] `json:"moderation"` }
type IBotSettings ¶
type IBotSettings struct { Guild string `json:"guild" form:"guild"` Prefix string `json:"prefix" form:"prefix"` Status string `json:"status" form:"status"` Activities []IBotActivity `json:"activities" form:"activities"` RandomizeActivities bool `json:"randomizeActivities" form:"randomizeActivities"` ActivityInterval int `json:"activityInterval" form:"activityInterval"` CurrentActivity int `json:"currentActivity"` Modules IBotModules `json:"modules" form:"modules"` }
type IDiscordApiUser ¶
type IDiscordApiUser struct { ID string `json:"id"` Username string `json:"username"` Discriminator string `json:"discriminator"` Avatar *string `json:"avatar,omitempty"` Bot *bool `json:"bot,omitempty"` System *bool `json:"system,omitempty"` MFAEnabled *bool `json:"mfa_enabled,omitempty"` Banner *string `json:"banner,omitempty"` AccentColor *int `json:"accent_color,omitempty"` Locale *string `json:"locale,omitempty"` Verified *bool `json:"verified,omitempty"` Email *string `json:"email,omitempty"` Flags *int `json:"flags,omitempty"` PremiumType *int `json:"premium_type,omitempty"` PublicFlags *int `json:"public_flags,omitempty"` }
type IIdentityData ¶
type IIdentityData struct { Iss string `json:"iss"` Sub string `json:"sub"` Name string `json:"name"` Email string `json:"email"` Picture string `json:"picture"` FullName string `json:"full_name"` AvatarURL string `json:"avatar_url"` ProviderID string `json:"provider_id"` EmailVerified bool `json:"email_verified"` }
type IIntegration ¶
type IIntegration struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` Name string `json:"name"` PrettyName string `json:"prettyName"` Icon string `json:"icon"` IsIconSimpleIcon bool `json:"isIconSimpleIcon"` Website string `json:"website"` Enabled bool `json:"enabled"` Description string `json:"description"` Schema IIntegrationSchema `json:"schema"` }
type IIntegrationSchema ¶
type IIntegrationSchema struct { Type string `json:"type"` Title string `json:"title"` Properties OrderedMap `json:"properties"` }
type IIntegrationSchemaInput ¶
type IPermissions ¶
type IProfile ¶
type IProfile struct { ID string `json:"id"` Email string `json:"email"` PreferredName string `json:"preferred_name"` IdentityData IIdentityData `json:"identity_data"` Access string `json:"access"` DiscordID string `json:"discord_id"` RobloxID interface{} `json:"roblox_id"` StripeCustomerID string `json:"stripe_customer_id"` CreatedAt string `json:"created_at"` Location string `json:"location"` Language string `json:"language"` Pronouns []string `json:"pronouns"` Hireable bool `json:"hireable"` About string `json:"about"` Strengths []string `json:"strengths"` Weaknesses []string `json:"weaknesses"` Banner string `json:"banner"` Verified bool `json:"verified"` Public bool `json:"public"` Workspaces []IWorkspace `json:"workspaces"` }
type IProvider ¶
type IProvider struct { ID *string `json:"id,omitempty"` CreatedAt time.Time `json:"created_at"` User string `json:"user"` Type string `json:"type"` ProviderID string `json:"provider_id"` ProviderAccessToken string `json:"provider_access_token"` ProviderRefreshToken string `json:"provider_refresh_token"` ProviderData map[string]interface{} `json:"provider_data"` ProviderExpiresAt *time.Time `json:"provider_expires_at,omitempty"` ProviderAvatarUrl *string `json:"provider_avatar_url,omitempty"` ProviderEmail *string `json:"provider_email,omitempty"` }
type IRegion ¶
type IRegion struct { ID string `json:"id"` Flag string `json:"flag"` IP string `json:"ip"` City string `json:"city"` Country string `json:"country"` Region string `json:"region"` PrettyName string `json:"prettyName"` Lat float64 `json:"lat"` Long float64 `json:"long"` MaxBots int `json:"maxBots"` Status string `json:"status"` Bots int `json:"bots"` }
type IRobloxIntegration ¶
type IRobloxIntegration struct { GroupId string `json:"groupId" form:"groupId"` Token string `json:"token" form:"token"` MemberCounter IRobloxIntegrationMemberCounter `json:"memberCounter" form:"memberCounter"` ShoutProxy IRobloxIntegrationShoutProxy `json:"shoutProxy" form:"shoutProxy"` BadActorDetection IRobloxIntegrationBadActorDetection `json:"badActorDetection" form:"badActorDetection"` WallFilter IRobloxIntegrationWallFilter `json:"wallFilter" form:"wallFilter"` }
type IRobloxIntegrationBadActorDetection ¶
type IRobloxIntegrationBadActorDetection struct { Enabled bool `json:"enabled" form:"enabled"` Factors struct { BannedGroups string `json:"bannedGroups" form:"bannedGroups"` SketchyUsername bool `json:"sketchyUsername" form:"sketchyUsername"` NoDescription bool `json:"noDescription" form:"noDescription"` } }
type IRobloxSchema ¶
type IRobloxSchema struct { GroupId orderedjson.Map `json:"groupId"` Token orderedjson.Map `json:"token"` MemberCounter orderedjson.Map `json:"member_counter"` ShoutProxy orderedjson.Map `json:"shout_proxy"` BadActorDetection orderedjson.Map `json:"bad_actor_detection"` WallFilter orderedjson.Map `json:"wall_filter"` Submit orderedjson.Map `json:"submit"` }
type IRobloxSchemaBadActorDetection ¶
type IRobloxSchemaBadActorDetection struct { Enabled orderedjson.Map `json:"enabled"` Factors orderedjson.Map `json:"factors"` }
type IRobloxSchemaFactors ¶
type IRobloxSchemaFactors struct { BannedGroups orderedjson.Map `json:"banned_groups"` SketchyUsername orderedjson.Map `json:"sketchyUsername"` NoDescription orderedjson.Map `json:"noDescription"` }
type IRobloxSchemaMemberCounter ¶
type IRobloxSchemaMemberCounter struct { Enabled orderedjson.Map `json:"enabled"` Message orderedjson.Map `json:"message"` Webhook orderedjson.Map `json:"webhook"` GroupId orderedjson.Map `json:"groupId"` }
type IRobloxSchemaShoutProxy ¶
type IRobloxSchemaShoutProxy struct { Enabled orderedjson.Map `json:"enabled"` Webhook orderedjson.Map `json:"webhook"` GroupId orderedjson.Map `json:"groupId"` }
type IRobloxSchemaWallFilter ¶
type IRobloxSchemaWallFilter struct {
BannedPhrases orderedjson.Map `json:"bannedPhrases"`
}
type IStatistic ¶
type ITeamMember ¶
type ITeamMemberUser ¶
type ITeamMemberUser struct {
IdentityData IIdentityData `json:"identity_data"`
}
type IWorkspace ¶
type IWorkspace struct { ID *string `json:"id,omitempty"` CreatedAt *string `json:"created_at,omitempty"` Owner *string `json:"owner,omitempty"` Members *[]string `json:"members,omitempty"` GroupID *string `json:"group_id,omitempty"` Name string `json:"name" form:"name"` Logo string `json:"logo" form:"logo"` Settings interface{} `json:"settings"` Plan int64 `json:"plan" form:"plan"` Visibility string `json:"visibility" form:"visibility"` Integrations interface{} `json:"integrations"` Pending bool `json:"pending"` }
type IWorkspaceIntegration ¶
type IWorkspaceMember ¶
type MemoryUsage ¶
func GetMemoryUsage ¶
func GetMemoryUsage() MemoryUsage
type OrderedMap ¶
func (OrderedMap) MarshalJSON ¶
func (om OrderedMap) MarshalJSON() ([]byte, error)
func (*OrderedMap) UnmarshalJSON ¶
func (om *OrderedMap) UnmarshalJSON(b []byte) error
type RealtimeOptions ¶
type RealtimeOptions struct { Endpoint string Key string Table string OnInsert func(m realtimego.Message) OnDelete func(m realtimego.Message) OnUpdate func(m realtimego.Message) }
func (RealtimeOptions) SetupRealtime ¶
func (opts RealtimeOptions) SetupRealtime()
type RealtimePayload ¶
type RealtimePayload[T any] struct { Columns []map[string]string `json:"columns"` CommitTimestamp time.Time `json:"commit_timestamp"` Errors *any `json:"errors,omitempty"` OldRecord T `json:"old_record"` Record T `json:"record"` Schema string `json:"schema"` Table string `json:"table"` Type string `json:"type"` }
type RedditPost ¶
type RedditPost struct { ApprovedAtUTC interface{} `json:"approved_at_utc"` Subreddit string `json:"subreddit"` Selftext string `json:"selftext"` UserReports []interface{} `json:"user_reports"` Saved bool `json:"saved"` ModReasonTitle interface{} `json:"mod_reason_title"` Gilded int64 `json:"gilded"` Clicked bool `json:"clicked"` Title string `json:"title"` LinkFlairRichtext []interface{} `json:"link_flair_richtext"` SubredditNamePrefixed string `json:"subreddit_name_prefixed"` Hidden bool `json:"hidden"` Pwls int64 `json:"pwls"` LinkFlairCSSClass interface{} `json:"link_flair_css_class"` Downs int64 `json:"downs"` ThumbnailHeight int64 `json:"thumbnail_height"` TopAwardedType interface{} `json:"top_awarded_type"` ParentWhitelistStatus string `json:"parent_whitelist_status"` HideScore bool `json:"hide_score"` Name string `json:"name"` Quarantine bool `json:"quarantine"` LinkFlairTextColor string `json:"link_flair_text_color"` UpvoteRatio int64 `json:"upvote_ratio"` AuthorFlairBackgroundColor interface{} `json:"author_flair_background_color"` SubredditType string `json:"subreddit_type"` UPS int64 `json:"ups"` TotalAwardsReceived int64 `json:"total_awards_received"` MediaEmbed Gildings `json:"media_embed"` ThumbnailWidth int64 `json:"thumbnail_width"` AuthorFlairTemplateID interface{} `json:"author_flair_template_id"` IsOriginalContent bool `json:"is_original_content"` AuthorFullname string `json:"author_fullname"` SecureMedia interface{} `json:"secure_media"` IsRedditMediaDomain bool `json:"is_reddit_media_domain"` IsMeta bool `json:"is_meta"` Category interface{} `json:"category"` SecureMediaEmbed Gildings `json:"secure_media_embed"` LinkFlairText interface{} `json:"link_flair_text"` CanModPost bool `json:"can_mod_post"` Score int64 `json:"score"` ApprovedBy interface{} `json:"approved_by"` IsCreatedFromAdsUI bool `json:"is_created_from_ads_ui"` AuthorPremium bool `json:"author_premium"` Thumbnail string `json:"thumbnail"` Edited bool `json:"edited"` AuthorFlairCSSClass interface{} `json:"author_flair_css_class"` AuthorFlairRichtext []interface{} `json:"author_flair_richtext"` Gildings Gildings `json:"gildings"` PostHint string `json:"post_hint"` ContentCategories interface{} `json:"content_categories"` IsSelf bool `json:"is_self"` ModNote interface{} `json:"mod_note"` Created int64 `json:"created"` LinkFlairType string `json:"link_flair_type"` Wls int64 `json:"wls"` RemovedByCategory interface{} `json:"removed_by_category"` BannedBy interface{} `json:"banned_by"` AuthorFlairType string `json:"author_flair_type"` Domain string `json:"domain"` AllowLiveComments bool `json:"allow_live_comments"` SelftextHTML interface{} `json:"selftext_html"` Likes interface{} `json:"likes"` SuggestedSort interface{} `json:"suggested_sort"` BannedAtUTC interface{} `json:"banned_at_utc"` URLOverriddenByDest string `json:"url_overridden_by_dest"` ViewCount interface{} `json:"view_count"` Archived bool `json:"archived"` NoFollow bool `json:"no_follow"` IsCrosspostable bool `json:"is_crosspostable"` Pinned bool `json:"pinned"` Over18 bool `json:"over_18"` Preview Preview `json:"preview"` AllAwardings []interface{} `json:"all_awardings"` Awarders []interface{} `json:"awarders"` MediaOnly bool `json:"media_only"` CanGild bool `json:"can_gild"` Spoiler bool `json:"spoiler"` Locked bool `json:"locked"` AuthorFlairText interface{} `json:"author_flair_text"` TreatmentTags []interface{} `json:"treatment_tags"` Visited bool `json:"visited"` RemovedBy interface{} `json:"removed_by"` NumReports interface{} `json:"num_reports"` Distinguished interface{} `json:"distinguished"` SubredditID string `json:"subreddit_id"` AuthorIsBlocked bool `json:"author_is_blocked"` ModReasonBy interface{} `json:"mod_reason_by"` RemovalReason interface{} `json:"removal_reason"` LinkFlairBackgroundColor string `json:"link_flair_background_color"` ID string `json:"id"` IsRobotIndexable bool `json:"is_robot_indexable"` NumDuplicates int64 `json:"num_duplicates"` ReportReasons interface{} `json:"report_reasons"` Author string `json:"author"` DiscussionType interface{} `json:"discussion_type"` NumComments int64 `json:"num_comments"` SendReplies bool `json:"send_replies"` Media interface{} `json:"media"` ContestMode bool `json:"contest_mode"` AuthorPatreonFlair bool `json:"author_patreon_flair"` AuthorFlairTextColor interface{} `json:"author_flair_text_color"` Permalink string `json:"permalink"` WhitelistStatus string `json:"whitelist_status"` Stickied bool `json:"stickied"` URL string `json:"url"` SubredditSubscribers int64 `json:"subreddit_subscribers"` CreatedUTC int64 `json:"created_utc"` NumCrossposts int64 `json:"num_crossposts"` ModReports []interface{} `json:"mod_reports"` IsVideo bool `json:"is_video"` }
type RedditPostData ¶
type RedditResponse ¶
type RedditResponse []RedditResponseElement
type RedditResponseElement ¶
type RedditResponseElement struct { Kind string `json:"kind"` Data RedditPostData `json:"data"` }
Click to show internal directories.
Click to hide internal directories.