1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894 |
- package discordgo
- import (
- "encoding/json"
- "fmt"
- "math"
- "net/http"
- "regexp"
- "strings"
- "sync"
- "time"
- "github.com/gorilla/websocket"
- )
- type Session struct {
- sync.RWMutex
-
-
-
- Token string
- MFA bool
-
- Debug bool
- LogLevel int
-
- ShouldReconnectOnError bool
-
-
- Identify Identify
-
-
- Compress bool
-
- ShardID int
- ShardCount int
-
-
-
- StateEnabled bool
-
-
- SyncEvents bool
-
-
- DataReady bool
-
- MaxRestRetries int
-
-
- status int32
-
- VoiceReady bool
-
- UDPReady bool
-
- VoiceConnections map[string]*VoiceConnection
-
-
- State *State
-
- Client *http.Client
-
- UserAgent string
-
- LastHeartbeatAck time.Time
-
- LastHeartbeatSent time.Time
-
- Ratelimiter *RateLimiter
-
- handlersMu sync.RWMutex
- handlers map[string][]*eventHandlerInstance
- onceHandlers map[string][]*eventHandlerInstance
-
- wsConn *websocket.Conn
-
- listening chan interface{}
-
- sequence *int64
-
- gateway string
-
- sessionID string
-
- wsMutex sync.Mutex
- }
- type Application struct {
- ID string `json:"id,omitempty"`
- Name string `json:"name"`
- Icon string `json:"icon,omitempty"`
- Description string `json:"description,omitempty"`
- RPCOrigins []string `json:"rpc_origins,omitempty"`
- BotPublic bool `json:"bot_public,omitempty"`
- BotRequireCodeGrant bool `json:"bot_require_code_grant,omitempty"`
- TermsOfServiceURL string `json:"terms_of_service_url"`
- PrivacyProxyURL string `json:"privacy_policy_url"`
- Owner *User `json:"owner"`
- Summary string `json:"summary"`
- VerifyKey string `json:"verify_key"`
- Team *Team `json:"team"`
- GuildID string `json:"guild_id"`
- PrimarySKUID string `json:"primary_sku_id"`
- Slug string `json:"slug"`
- CoverImage string `json:"cover_image"`
- Flags int `json:"flags,omitempty"`
- }
- type UserConnection struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Type string `json:"type"`
- Revoked bool `json:"revoked"`
- Integrations []*Integration `json:"integrations"`
- }
- type Integration struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Type string `json:"type"`
- Enabled bool `json:"enabled"`
- Syncing bool `json:"syncing"`
- RoleID string `json:"role_id"`
- EnableEmoticons bool `json:"enable_emoticons"`
- ExpireBehavior ExpireBehavior `json:"expire_behavior"`
- ExpireGracePeriod int `json:"expire_grace_period"`
- User *User `json:"user"`
- Account IntegrationAccount `json:"account"`
- SyncedAt time.Time `json:"synced_at"`
- }
- type ExpireBehavior int
- const (
- ExpireBehaviorRemoveRole ExpireBehavior = 0
- ExpireBehaviorKick ExpireBehavior = 1
- )
- type IntegrationAccount struct {
- ID string `json:"id"`
- Name string `json:"name"`
- }
- type VoiceRegion struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Hostname string `json:"sample_hostname"`
- Port int `json:"sample_port"`
- }
- type VoiceICE struct {
- TTL string `json:"ttl"`
- Servers []*ICEServer `json:"servers"`
- }
- type ICEServer struct {
- URL string `json:"url"`
- Username string `json:"username"`
- Credential string `json:"credential"`
- }
- type InviteTargetType uint8
- const (
- InviteTargetStream InviteTargetType = 1
- InviteTargetEmbeddedAppliction InviteTargetType = 2
- )
- type Invite struct {
- Guild *Guild `json:"guild"`
- Channel *Channel `json:"channel"`
- Inviter *User `json:"inviter"`
- Code string `json:"code"`
- CreatedAt time.Time `json:"created_at"`
- MaxAge int `json:"max_age"`
- Uses int `json:"uses"`
- MaxUses int `json:"max_uses"`
- Revoked bool `json:"revoked"`
- Temporary bool `json:"temporary"`
- Unique bool `json:"unique"`
- TargetUser *User `json:"target_user"`
- TargetType InviteTargetType `json:"target_type"`
- TargetApplication *Application `json:"target_application"`
-
- ApproximatePresenceCount int `json:"approximate_presence_count"`
- ApproximateMemberCount int `json:"approximate_member_count"`
- }
- type ChannelType int
- const (
- ChannelTypeGuildText ChannelType = 0
- ChannelTypeDM ChannelType = 1
- ChannelTypeGuildVoice ChannelType = 2
- ChannelTypeGroupDM ChannelType = 3
- ChannelTypeGuildCategory ChannelType = 4
- ChannelTypeGuildNews ChannelType = 5
- ChannelTypeGuildStore ChannelType = 6
- ChannelTypeGuildNewsThread ChannelType = 10
- ChannelTypeGuildPublicThread ChannelType = 11
- ChannelTypeGuildPrivateThread ChannelType = 12
- )
- type Channel struct {
-
- ID string `json:"id"`
-
-
- GuildID string `json:"guild_id"`
-
- Name string `json:"name"`
-
- Topic string `json:"topic"`
-
- Type ChannelType `json:"type"`
-
-
- LastMessageID string `json:"last_message_id"`
-
-
- LastPinTimestamp *time.Time `json:"last_pin_timestamp"`
-
- MessageCount int `json:"message_count"`
-
- MemberCount int `json:"member_count"`
-
- NSFW bool `json:"nsfw"`
-
- Icon string `json:"icon"`
-
- Position int `json:"position"`
-
- Bitrate int `json:"bitrate"`
-
- Recipients []*User `json:"recipients"`
-
-
- Messages []*Message `json:"-"`
-
- PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites"`
-
- UserLimit int `json:"user_limit"`
-
- ParentID string `json:"parent_id"`
-
-
- RateLimitPerUser int `json:"rate_limit_per_user"`
-
- OwnerID string `json:"owner_id"`
-
- ApplicationID string `json:"application_id"`
-
- ThreadMetadata *ThreadMetadata `json:"thread_metadata,omitempty"`
-
- Member *ThreadMember `json:"thread_member"`
-
- Members []*ThreadMember `json:"-"`
- }
- func (c *Channel) Mention() string {
- return fmt.Sprintf("<#%s>", c.ID)
- }
- func (c *Channel) IsThread() bool {
- return c.Type == ChannelTypeGuildPublicThread || c.Type == ChannelTypeGuildPrivateThread || c.Type == ChannelTypeGuildNewsThread
- }
- type ChannelEdit struct {
- Name string `json:"name,omitempty"`
- Topic string `json:"topic,omitempty"`
- NSFW bool `json:"nsfw,omitempty"`
- Position int `json:"position"`
- Bitrate int `json:"bitrate,omitempty"`
- UserLimit int `json:"user_limit,omitempty"`
- PermissionOverwrites []*PermissionOverwrite `json:"permission_overwrites,omitempty"`
- ParentID string `json:"parent_id,omitempty"`
- RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
-
- Archived bool `json:"archived,omitempty"`
- AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
- Locked bool `json:"locked,bool"`
- Invitable bool `json:"invitable,omitempty"`
- }
- type ChannelFollow struct {
- ChannelID string `json:"channel_id"`
- WebhookID string `json:"webhook_id"`
- }
- type PermissionOverwriteType int
- const (
- PermissionOverwriteTypeRole PermissionOverwriteType = 0
- PermissionOverwriteTypeMember PermissionOverwriteType = 1
- )
- type PermissionOverwrite struct {
- ID string `json:"id"`
- Type PermissionOverwriteType `json:"type"`
- Deny int64 `json:"deny,string"`
- Allow int64 `json:"allow,string"`
- }
- type ThreadStart struct {
- Name string `json:"name"`
- AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
- Type ChannelType `json:"type,omitempty"`
- Invitable bool `json:"invitable"`
- RateLimitPerUser int `json:"rate_limit_per_user,omitempty"`
- }
- type ThreadMetadata struct {
-
- Archived bool `json:"archived"`
-
- AutoArchiveDuration int `json:"auto_archive_duration"`
-
- ArchiveTimestamp time.Time `json:"archive_timestamp"`
-
- Locked bool `json:"locked"`
-
- Invitable bool `json:"invitable"`
- }
- type ThreadMember struct {
-
- ID string `json:"id,omitempty"`
-
- UserID string `json:"user_id,omitempty"`
-
- JoinTimestamp time.Time `json:"join_timestamp"`
-
- Flags int
- }
- type ThreadsList struct {
- Threads []*Channel `json:"threads"`
- Members []*ThreadMember `json:"members"`
- HasMore bool `json:"has_more"`
- }
- type AddedThreadMember struct {
- *ThreadMember
- Member *Member `json:"member"`
- Presence *Presence `json:"presence"`
- }
- type Emoji struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Roles []string `json:"roles"`
- User *User `json:"user"`
- RequireColons bool `json:"require_colons"`
- Managed bool `json:"managed"`
- Animated bool `json:"animated"`
- Available bool `json:"available"`
- }
- var (
- EmojiRegex = regexp.MustCompile(`<(a|):[A-z0-9_~]+:[0-9]{18}>`)
- )
- func (e *Emoji) MessageFormat() string {
- if e.ID != "" && e.Name != "" {
- if e.Animated {
- return "<a:" + e.APIName() + ">"
- }
- return "<:" + e.APIName() + ">"
- }
- return e.APIName()
- }
- func (e *Emoji) APIName() string {
- if e.ID != "" && e.Name != "" {
- return e.Name + ":" + e.ID
- }
- if e.Name != "" {
- return e.Name
- }
- return e.ID
- }
- type StickerFormat int
- const (
- StickerFormatTypePNG StickerFormat = 1
- StickerFormatTypeAPNG StickerFormat = 2
- StickerFormatTypeLottie StickerFormat = 3
- )
- type StickerType int
- const (
- StickerTypeStandard StickerType = 1
- StickerTypeGuild StickerType = 2
- )
- type Sticker struct {
- ID string `json:"id"`
- PackID string `json:"pack_id"`
- Name string `json:"name"`
- Description string `json:"description"`
- Tags string `json:"tags"`
- Type StickerType `json:"type"`
- FormatType StickerFormat `json:"format_type"`
- Available bool `json:"available"`
- GuildID string `json:"guild_id"`
- User *User `json:"user"`
- SortValue int `json:"sort_value"`
- }
- type StickerPack struct {
- ID string `json:"id"`
- Stickers []*Sticker `json:"stickers"`
- Name string `json:"name"`
- SKUID string `json:"sku_id"`
- CoverStickerID string `json:"cover_sticker_id"`
- Description string `json:"description"`
- BannerAssetID string `json:"banner_asset_id"`
- }
- type VerificationLevel int
- const (
- VerificationLevelNone VerificationLevel = 0
- VerificationLevelLow VerificationLevel = 1
- VerificationLevelMedium VerificationLevel = 2
- VerificationLevelHigh VerificationLevel = 3
- VerificationLevelVeryHigh VerificationLevel = 4
- )
- type ExplicitContentFilterLevel int
- const (
- ExplicitContentFilterDisabled ExplicitContentFilterLevel = 0
- ExplicitContentFilterMembersWithoutRoles ExplicitContentFilterLevel = 1
- ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2
- )
- type MfaLevel int
- const (
- MfaLevelNone MfaLevel = 0
- MfaLevelElevated MfaLevel = 1
- )
- type PremiumTier int
- const (
- PremiumTierNone PremiumTier = 0
- PremiumTier1 PremiumTier = 1
- PremiumTier2 PremiumTier = 2
- PremiumTier3 PremiumTier = 3
- )
- type Guild struct {
-
- ID string `json:"id"`
-
- Name string `json:"name"`
-
-
- Icon string `json:"icon"`
-
- Region string `json:"region"`
-
- AfkChannelID string `json:"afk_channel_id"`
-
- OwnerID string `json:"owner_id"`
-
- Owner bool `json:"owner"`
-
-
-
- JoinedAt time.Time `json:"joined_at"`
-
- DiscoverySplash string `json:"discovery_splash"`
-
- Splash string `json:"splash"`
-
- AfkTimeout int `json:"afk_timeout"`
-
-
-
- MemberCount int `json:"member_count"`
-
- VerificationLevel VerificationLevel `json:"verification_level"`
-
-
-
- Large bool `json:"large"`
-
- DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"`
-
- Roles []*Role `json:"roles"`
-
- Emojis []*Emoji `json:"emojis"`
-
- Stickers []*Sticker `json:"stickers"`
-
-
-
- Members []*Member `json:"members"`
-
-
-
- Presences []*Presence `json:"presences"`
-
- MaxPresences int `json:"max_presences"`
-
- MaxMembers int `json:"max_members"`
-
-
-
- Channels []*Channel `json:"channels"`
-
-
-
- Threads []*Channel `json:"threads"`
-
-
-
- VoiceStates []*VoiceState `json:"voice_states"`
-
-
-
- Unavailable bool `json:"unavailable"`
-
- ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"`
-
- Features []string `json:"features"`
-
- MfaLevel MfaLevel `json:"mfa_level"`
-
- ApplicationID string `json:"application_id"`
-
- WidgetEnabled bool `json:"widget_enabled"`
-
- WidgetChannelID string `json:"widget_channel_id"`
-
- SystemChannelID string `json:"system_channel_id"`
-
- SystemChannelFlags SystemChannelFlag `json:"system_channel_flags"`
-
- RulesChannelID string `json:"rules_channel_id"`
-
- VanityURLCode string `json:"vanity_url_code"`
-
- Description string `json:"description"`
-
- Banner string `json:"banner"`
-
- PremiumTier PremiumTier `json:"premium_tier"`
-
- PremiumSubscriptionCount int `json:"premium_subscription_count"`
-
- PreferredLocale string `json:"preferred_locale"`
-
- PublicUpdatesChannelID string `json:"public_updates_channel_id"`
-
- MaxVideoChannelUsers int `json:"max_video_channel_users"`
-
- ApproximateMemberCount int `json:"approximate_member_count"`
-
- ApproximatePresenceCount int `json:"approximate_presence_count"`
-
- Permissions int64 `json:"permissions,string"`
- }
- type GuildPreview struct {
-
- ID string `json:"id"`
-
- Name string `json:"name"`
-
-
- Icon string `json:"icon"`
-
- Splash string `json:"splash"`
-
- DiscoverySplash string `json:"discovery_splash"`
-
- Emojis []*Emoji `json:"emojis"`
-
- Features []string `json:"features"`
-
- ApproximateMemberCount int `json:"approximate_member_count"`
-
- ApproximatePresenceCount int `json:"approximate_presence_count"`
-
- Description string `json:"description"`
- }
- type GuildTemplate struct {
-
- Code string `json:"code"`
-
- Name string `json:"name"`
-
- Description string `json:"description"`
-
- UsageCount string `json:"usage_count"`
-
- CreatorID string `json:"creator_id"`
-
- Creator *User `json:"creator"`
-
- CreatedAt time.Time `json:"created_at"`
-
- UpdatedAt time.Time `json:"updated_at"`
-
- SourceGuildID string `json:"source_guild_id"`
-
- SerializedSourceGuild *Guild `json:"serialized_source_guild"`
-
- IsDirty bool `json:"is_dirty"`
- }
- type MessageNotifications int
- const (
- MessageNotificationsAllMessages MessageNotifications = 0
- MessageNotificationsOnlyMentions MessageNotifications = 1
- )
- type SystemChannelFlag int
- const (
- SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << 0
- SystemChannelFlagsSuppressPremium SystemChannelFlag = 1 << 1
- )
- func (g *Guild) IconURL() string {
- if g.Icon == "" {
- return ""
- }
- if strings.HasPrefix(g.Icon, "a_") {
- return EndpointGuildIconAnimated(g.ID, g.Icon)
- }
- return EndpointGuildIcon(g.ID, g.Icon)
- }
- func (g *Guild) BannerURL() string {
- if g.Banner == "" {
- return ""
- }
- return EndpointGuildBanner(g.ID, g.Banner)
- }
- type UserGuild struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Icon string `json:"icon"`
- Owner bool `json:"owner"`
- Permissions int64 `json:"permissions,string"`
- }
- type GuildParams struct {
- Name string `json:"name,omitempty"`
- Region string `json:"region,omitempty"`
- VerificationLevel *VerificationLevel `json:"verification_level,omitempty"`
- DefaultMessageNotifications int `json:"default_message_notifications,omitempty"`
- AfkChannelID string `json:"afk_channel_id,omitempty"`
- AfkTimeout int `json:"afk_timeout,omitempty"`
- Icon string `json:"icon,omitempty"`
- OwnerID string `json:"owner_id,omitempty"`
- Splash string `json:"splash,omitempty"`
- Banner string `json:"banner,omitempty"`
- }
- type Role struct {
-
- ID string `json:"id"`
-
- Name string `json:"name"`
-
-
- Managed bool `json:"managed"`
-
- Mentionable bool `json:"mentionable"`
-
- Hoist bool `json:"hoist"`
-
- Color int `json:"color"`
-
- Position int `json:"position"`
-
-
-
- Permissions int64 `json:"permissions,string"`
- }
- func (r *Role) Mention() string {
- return fmt.Sprintf("<@&%s>", r.ID)
- }
- type Roles []*Role
- func (r Roles) Len() int {
- return len(r)
- }
- func (r Roles) Less(i, j int) bool {
- return r[i].Position > r[j].Position
- }
- func (r Roles) Swap(i, j int) {
- r[i], r[j] = r[j], r[i]
- }
- type VoiceState struct {
- UserID string `json:"user_id"`
- SessionID string `json:"session_id"`
- ChannelID string `json:"channel_id"`
- GuildID string `json:"guild_id"`
- Suppress bool `json:"suppress"`
- SelfMute bool `json:"self_mute"`
- SelfDeaf bool `json:"self_deaf"`
- Mute bool `json:"mute"`
- Deaf bool `json:"deaf"`
- }
- type Presence struct {
- User *User `json:"user"`
- Status Status `json:"status"`
- Activities []*Activity `json:"activities"`
- Since *int `json:"since"`
- }
- type TimeStamps struct {
- EndTimestamp int64 `json:"end,omitempty"`
- StartTimestamp int64 `json:"start,omitempty"`
- }
- func (t *TimeStamps) UnmarshalJSON(b []byte) error {
- temp := struct {
- End float64 `json:"end,omitempty"`
- Start float64 `json:"start,omitempty"`
- }{}
- err := json.Unmarshal(b, &temp)
- if err != nil {
- return err
- }
- t.EndTimestamp = int64(temp.End)
- t.StartTimestamp = int64(temp.Start)
- return nil
- }
- type Assets struct {
- LargeImageID string `json:"large_image,omitempty"`
- SmallImageID string `json:"small_image,omitempty"`
- LargeText string `json:"large_text,omitempty"`
- SmallText string `json:"small_text,omitempty"`
- }
- type Member struct {
-
- GuildID string `json:"guild_id"`
-
- JoinedAt time.Time `json:"joined_at"`
-
- Nick string `json:"nick"`
-
- Deaf bool `json:"deaf"`
-
- Mute bool `json:"mute"`
-
- Avatar string `json:"avatar"`
-
- User *User `json:"user"`
-
- Roles []string `json:"roles"`
-
- PremiumSince *time.Time `json:"premium_since"`
-
- Pending bool `json:"pending"`
-
- Permissions int64 `json:"permissions,string"`
-
-
- CommunicationDisabledUntil *time.Time `json:"communication_disabled_until"`
- }
- func (m *Member) Mention() string {
- return "<@!" + m.User.ID + ">"
- }
- func (m *Member) AvatarURL(size string) string {
- if m.Avatar == "" {
- return m.User.AvatarURL(size)
- }
-
- return avatarURL(m.Avatar, "", EndpointGuildMemberAvatar(m.GuildID, m.User.ID, m.Avatar),
- EndpointGuildMemberAvatarAnimated(m.GuildID, m.User.ID, m.Avatar), size)
- }
- type Settings struct {
- RenderEmbeds bool `json:"render_embeds"`
- InlineEmbedMedia bool `json:"inline_embed_media"`
- InlineAttachmentMedia bool `json:"inline_attachment_media"`
- EnableTTSCommand bool `json:"enable_tts_command"`
- MessageDisplayCompact bool `json:"message_display_compact"`
- ShowCurrentGame bool `json:"show_current_game"`
- ConvertEmoticons bool `json:"convert_emoticons"`
- Locale string `json:"locale"`
- Theme string `json:"theme"`
- GuildPositions []string `json:"guild_positions"`
- RestrictedGuilds []string `json:"restricted_guilds"`
- FriendSourceFlags *FriendSourceFlags `json:"friend_source_flags"`
- Status Status `json:"status"`
- DetectPlatformAccounts bool `json:"detect_platform_accounts"`
- DeveloperMode bool `json:"developer_mode"`
- }
- type Status string
- const (
- StatusOnline Status = "online"
- StatusIdle Status = "idle"
- StatusDoNotDisturb Status = "dnd"
- StatusInvisible Status = "invisible"
- StatusOffline Status = "offline"
- )
- type FriendSourceFlags struct {
- All bool `json:"all"`
- MutualGuilds bool `json:"mutual_guilds"`
- MutualFriends bool `json:"mutual_friends"`
- }
- type Relationship struct {
- User *User `json:"user"`
- Type int `json:"type"`
- ID string `json:"id"`
- }
- type TooManyRequests struct {
- Bucket string `json:"bucket"`
- Message string `json:"message"`
- RetryAfter time.Duration `json:"retry_after"`
- }
- func (t *TooManyRequests) UnmarshalJSON(b []byte) error {
- u := struct {
- Bucket string `json:"bucket"`
- Message string `json:"message"`
- RetryAfter float64 `json:"retry_after"`
- }{}
- err := json.Unmarshal(b, &u)
- if err != nil {
- return err
- }
- t.Bucket = u.Bucket
- t.Message = u.Message
- whole, frac := math.Modf(u.RetryAfter)
- t.RetryAfter = time.Duration(whole)*time.Second + time.Duration(frac*1000)*time.Millisecond
- return nil
- }
- type ReadState struct {
- MentionCount int `json:"mention_count"`
- LastMessageID string `json:"last_message_id"`
- ID string `json:"id"`
- }
- type Ack struct {
- Token string `json:"token"`
- }
- type GuildRole struct {
- Role *Role `json:"role"`
- GuildID string `json:"guild_id"`
- }
- type GuildBan struct {
- Reason string `json:"reason"`
- User *User `json:"user"`
- }
- type GuildEmbed struct {
- Enabled bool `json:"enabled"`
- ChannelID string `json:"channel_id"`
- }
- type GuildAuditLog struct {
- Webhooks []*Webhook `json:"webhooks,omitempty"`
- Users []*User `json:"users,omitempty"`
- AuditLogEntries []*AuditLogEntry `json:"audit_log_entries"`
- Integrations []*Integration `json:"integrations"`
- }
- type AuditLogEntry struct {
- TargetID string `json:"target_id"`
- Changes []*AuditLogChange `json:"changes"`
- UserID string `json:"user_id"`
- ID string `json:"id"`
- ActionType *AuditLogAction `json:"action_type"`
- Options *AuditLogOptions `json:"options"`
- Reason string `json:"reason"`
- }
- type AuditLogChange struct {
- NewValue interface{} `json:"new_value"`
- OldValue interface{} `json:"old_value"`
- Key *AuditLogChangeKey `json:"key"`
- }
- type AuditLogChangeKey string
- const (
-
- AuditLogChangeKeyAfkChannelID AuditLogChangeKey = "afk_channel_id"
-
- AuditLogChangeKeyAfkTimeout AuditLogChangeKey = "afk_timeout"
-
- AuditLogChangeKeyAllow AuditLogChangeKey = "allow"
-
- AuditLogChangeKeyApplicationID AuditLogChangeKey = "application_id"
-
- AuditLogChangeKeyArchived AuditLogChangeKey = "archived"
-
- AuditLogChangeKeyAsset AuditLogChangeKey = "asset"
-
- AuditLogChangeKeyAutoArchiveDuration AuditLogChangeKey = "auto_archive_duration"
-
- AuditLogChangeKeyAvailable AuditLogChangeKey = "available"
-
- AuditLogChangeKeyAvatarHash AuditLogChangeKey = "avatar_hash"
-
- AuditLogChangeKeyBannerHash AuditLogChangeKey = "banner_hash"
-
- AuditLogChangeKeyBitrate AuditLogChangeKey = "bitrate"
-
- AuditLogChangeKeyChannelID AuditLogChangeKey = "channel_id"
-
- AuditLogChangeKeyCode AuditLogChangeKey = "code"
-
- AuditLogChangeKeyColor AuditLogChangeKey = "color"
-
- AuditLogChangeKeyCommunicationDisabledUntil AuditLogChangeKey = "communication_disabled_until"
-
- AuditLogChangeKeyDeaf AuditLogChangeKey = "deaf"
-
- AuditLogChangeKeyDefaultAutoArchiveDuration AuditLogChangeKey = "default_auto_archive_duration"
-
- AuditLogChangeKeyDefaultMessageNotification AuditLogChangeKey = "default_message_notifications"
-
- AuditLogChangeKeyDeny AuditLogChangeKey = "deny"
-
- AuditLogChangeKeyDescription AuditLogChangeKey = "description"
-
- AuditLogChangeKeyDiscoverySplashHash AuditLogChangeKey = "discovery_splash_hash"
-
- AuditLogChangeKeyEnableEmoticons AuditLogChangeKey = "enable_emoticons"
-
- AuditLogChangeKeyEntityType AuditLogChangeKey = "entity_type"
-
- AuditLogChangeKeyExpireBehavior AuditLogChangeKey = "expire_behavior"
-
- AuditLogChangeKeyExpireGracePeriod AuditLogChangeKey = "expire_grace_period"
-
- AuditLogChangeKeyExplicitContentFilter AuditLogChangeKey = "explicit_content_filter"
-
- AuditLogChangeKeyFormatType AuditLogChangeKey = "format_type"
-
- AuditLogChangeKeyGuildID AuditLogChangeKey = "guild_id"
-
- AuditLogChangeKeyHoist AuditLogChangeKey = "hoist"
-
- AuditLogChangeKeyIconHash AuditLogChangeKey = "icon_hash"
-
- AuditLogChangeKeyID AuditLogChangeKey = "id"
-
- AuditLogChangeKeyInvitable AuditLogChangeKey = "invitable"
-
- AuditLogChangeKeyInviterID AuditLogChangeKey = "inviter_id"
-
- AuditLogChangeKeyLocation AuditLogChangeKey = "location"
-
- AuditLogChangeKeyLocked AuditLogChangeKey = "locked"
-
- AuditLogChangeKeyMaxAge AuditLogChangeKey = "max_age"
-
- AuditLogChangeKeyMaxUses AuditLogChangeKey = "max_uses"
-
- AuditLogChangeKeyMentionable AuditLogChangeKey = "mentionable"
-
- AuditLogChangeKeyMfaLevel AuditLogChangeKey = "mfa_level"
-
- AuditLogChangeKeyMute AuditLogChangeKey = "mute"
-
- AuditLogChangeKeyName AuditLogChangeKey = "name"
-
- AuditLogChangeKeyNick AuditLogChangeKey = "nick"
-
- AuditLogChangeKeyNSFW AuditLogChangeKey = "nsfw"
-
- AuditLogChangeKeyOwnerID AuditLogChangeKey = "owner_id"
-
- AuditLogChangeKeyPermissionOverwrite AuditLogChangeKey = "permission_overwrites"
-
- AuditLogChangeKeyPermissions AuditLogChangeKey = "permissions"
-
- AuditLogChangeKeyPosition AuditLogChangeKey = "position"
-
- AuditLogChangeKeyPreferredLocale AuditLogChangeKey = "preferred_locale"
-
- AuditLogChangeKeyPrivacylevel AuditLogChangeKey = "privacy_level"
-
- AuditLogChangeKeyPruneDeleteDays AuditLogChangeKey = "prune_delete_days"
-
- AuditLogChangeKeyPulibUpdatesChannelID AuditLogChangeKey = "public_updates_channel_id"
-
- AuditLogChangeKeyRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user"
-
- AuditLogChangeKeyRegion AuditLogChangeKey = "region"
-
- AuditLogChangeKeyRulesChannelID AuditLogChangeKey = "rules_channel_id"
-
- AuditLogChangeKeySplashHash AuditLogChangeKey = "splash_hash"
-
- AuditLogChangeKeyStatus AuditLogChangeKey = "status"
-
- AuditLogChangeKeySystemChannelID AuditLogChangeKey = "system_channel_id"
-
- AuditLogChangeKeyTags AuditLogChangeKey = "tags"
-
- AuditLogChangeKeyTemporary AuditLogChangeKey = "temporary"
-
- AuditLogChangeKeyTempoary = AuditLogChangeKeyTemporary
-
- AuditLogChangeKeyTopic AuditLogChangeKey = "topic"
-
- AuditLogChangeKeyType AuditLogChangeKey = "type"
-
- AuditLogChangeKeyUnicodeEmoji AuditLogChangeKey = "unicode_emoji"
-
- AuditLogChangeKeyUserLimit AuditLogChangeKey = "user_limit"
-
- AuditLogChangeKeyUses AuditLogChangeKey = "uses"
-
- AuditLogChangeKeyVanityURLCode AuditLogChangeKey = "vanity_url_code"
-
- AuditLogChangeKeyVerificationLevel AuditLogChangeKey = "verification_level"
-
- AuditLogChangeKeyWidgetChannelID AuditLogChangeKey = "widget_channel_id"
-
- AuditLogChangeKeyWidgetEnabled AuditLogChangeKey = "widget_enabled"
-
- AuditLogChangeKeyRoleAdd AuditLogChangeKey = "$add"
-
- AuditLogChangeKeyRoleRemove AuditLogChangeKey = "$remove"
- )
- type AuditLogOptions struct {
- DeleteMemberDays string `json:"delete_member_days"`
- MembersRemoved string `json:"members_removed"`
- ChannelID string `json:"channel_id"`
- MessageID string `json:"message_id"`
- Count string `json:"count"`
- ID string `json:"id"`
- Type *AuditLogOptionsType `json:"type"`
- RoleName string `json:"role_name"`
- }
- type AuditLogOptionsType string
- const (
- AuditLogOptionsTypeMember AuditLogOptionsType = "member"
- AuditLogOptionsTypeRole AuditLogOptionsType = "role"
- )
- type AuditLogAction int
- const (
- AuditLogActionGuildUpdate AuditLogAction = 1
- AuditLogActionChannelCreate AuditLogAction = 10
- AuditLogActionChannelUpdate AuditLogAction = 11
- AuditLogActionChannelDelete AuditLogAction = 12
- AuditLogActionChannelOverwriteCreate AuditLogAction = 13
- AuditLogActionChannelOverwriteUpdate AuditLogAction = 14
- AuditLogActionChannelOverwriteDelete AuditLogAction = 15
- AuditLogActionMemberKick AuditLogAction = 20
- AuditLogActionMemberPrune AuditLogAction = 21
- AuditLogActionMemberBanAdd AuditLogAction = 22
- AuditLogActionMemberBanRemove AuditLogAction = 23
- AuditLogActionMemberUpdate AuditLogAction = 24
- AuditLogActionMemberRoleUpdate AuditLogAction = 25
- AuditLogActionMemberMove AuditLogAction = 26
- AuditLogActionMemberDisconnect AuditLogAction = 27
- AuditLogActionBotAdd AuditLogAction = 28
- AuditLogActionRoleCreate AuditLogAction = 30
- AuditLogActionRoleUpdate AuditLogAction = 31
- AuditLogActionRoleDelete AuditLogAction = 32
- AuditLogActionInviteCreate AuditLogAction = 40
- AuditLogActionInviteUpdate AuditLogAction = 41
- AuditLogActionInviteDelete AuditLogAction = 42
- AuditLogActionWebhookCreate AuditLogAction = 50
- AuditLogActionWebhookUpdate AuditLogAction = 51
- AuditLogActionWebhookDelete AuditLogAction = 52
- AuditLogActionEmojiCreate AuditLogAction = 60
- AuditLogActionEmojiUpdate AuditLogAction = 61
- AuditLogActionEmojiDelete AuditLogAction = 62
- AuditLogActionMessageDelete AuditLogAction = 72
- AuditLogActionMessageBulkDelete AuditLogAction = 73
- AuditLogActionMessagePin AuditLogAction = 74
- AuditLogActionMessageUnpin AuditLogAction = 75
- AuditLogActionIntegrationCreate AuditLogAction = 80
- AuditLogActionIntegrationUpdate AuditLogAction = 81
- AuditLogActionIntegrationDelete AuditLogAction = 82
- AuditLogActionStageInstanceCreate AuditLogAction = 83
- AuditLogActionStageInstanceUpdate AuditLogAction = 84
- AuditLogActionStageInstanceDelete AuditLogAction = 85
- AuditLogActionStickerCreate AuditLogAction = 90
- AuditLogActionStickerUpdate AuditLogAction = 91
- AuditLogActionStickerDelete AuditLogAction = 92
- AuditLogGuildScheduledEventCreate AuditLogAction = 100
- AuditLogGuildScheduledEventUpdare AuditLogAction = 101
- AuditLogGuildScheduledEventDelete AuditLogAction = 102
- AuditLogActionThreadCreate AuditLogAction = 110
- AuditLogActionThreadUpdate AuditLogAction = 111
- AuditLogActionThreadDelete AuditLogAction = 112
- )
- type UserGuildSettingsChannelOverride struct {
- Muted bool `json:"muted"`
- MessageNotifications int `json:"message_notifications"`
- ChannelID string `json:"channel_id"`
- }
- type UserGuildSettings struct {
- SupressEveryone bool `json:"suppress_everyone"`
- Muted bool `json:"muted"`
- MobilePush bool `json:"mobile_push"`
- MessageNotifications int `json:"message_notifications"`
- GuildID string `json:"guild_id"`
- ChannelOverrides []*UserGuildSettingsChannelOverride `json:"channel_overrides"`
- }
- type UserGuildSettingsEdit struct {
- SupressEveryone bool `json:"suppress_everyone"`
- Muted bool `json:"muted"`
- MobilePush bool `json:"mobile_push"`
- MessageNotifications int `json:"message_notifications"`
- ChannelOverrides map[string]*UserGuildSettingsChannelOverride `json:"channel_overrides"`
- }
- type APIErrorMessage struct {
- Code int `json:"code"`
- Message string `json:"message"`
- }
- type MessageReaction struct {
- UserID string `json:"user_id"`
- MessageID string `json:"message_id"`
- Emoji Emoji `json:"emoji"`
- ChannelID string `json:"channel_id"`
- GuildID string `json:"guild_id,omitempty"`
- }
- type GatewayBotResponse struct {
- URL string `json:"url"`
- Shards int `json:"shards"`
- SessionStartLimit SessionInformation `json:"session_start_limit"`
- }
- type SessionInformation struct {
- Total int `json:"total,omitempty"`
- Remaining int `json:"remaining,omitempty"`
- ResetAfter int `json:"reset_after,omitempty"`
- MaxConcurrency int `json:"max_concurrency,omitempty"`
- }
- type GatewayStatusUpdate struct {
- Since int `json:"since"`
- Game Activity `json:"game"`
- Status string `json:"status"`
- AFK bool `json:"afk"`
- }
- type Activity struct {
- Name string `json:"name"`
- Type ActivityType `json:"type"`
- URL string `json:"url,omitempty"`
- CreatedAt time.Time `json:"created_at"`
- ApplicationID string `json:"application_id,omitempty"`
- State string `json:"state,omitempty"`
- Details string `json:"details,omitempty"`
- Timestamps TimeStamps `json:"timestamps,omitempty"`
- Emoji Emoji `json:"emoji,omitempty"`
- Party Party `json:"party,omitempty"`
- Assets Assets `json:"assets,omitempty"`
- Secrets Secrets `json:"secrets,omitempty"`
- Instance bool `json:"instance,omitempty"`
- Flags int `json:"flags,omitempty"`
- }
- func (activity *Activity) UnmarshalJSON(b []byte) error {
- temp := struct {
- Name string `json:"name"`
- Type ActivityType `json:"type"`
- URL string `json:"url,omitempty"`
- CreatedAt int64 `json:"created_at"`
- ApplicationID string `json:"application_id,omitempty"`
- State string `json:"state,omitempty"`
- Details string `json:"details,omitempty"`
- Timestamps TimeStamps `json:"timestamps,omitempty"`
- Emoji Emoji `json:"emoji,omitempty"`
- Party Party `json:"party,omitempty"`
- Assets Assets `json:"assets,omitempty"`
- Secrets Secrets `json:"secrets,omitempty"`
- Instance bool `json:"instance,omitempty"`
- Flags int `json:"flags,omitempty"`
- }{}
- err := json.Unmarshal(b, &temp)
- if err != nil {
- return err
- }
- activity.CreatedAt = time.Unix(0, temp.CreatedAt*1000000)
- activity.ApplicationID = temp.ApplicationID
- activity.Assets = temp.Assets
- activity.Details = temp.Details
- activity.Emoji = temp.Emoji
- activity.Flags = temp.Flags
- activity.Instance = temp.Instance
- activity.Name = temp.Name
- activity.Party = temp.Party
- activity.Secrets = temp.Secrets
- activity.State = temp.State
- activity.Timestamps = temp.Timestamps
- activity.Type = temp.Type
- activity.URL = temp.URL
- return nil
- }
- type Party struct {
- ID string `json:"id,omitempty"`
- Size []int `json:"size,omitempty"`
- }
- type Secrets struct {
- Join string `json:"join,omitempty"`
- Spectate string `json:"spectate,omitempty"`
- Match string `json:"match,omitempty"`
- }
- type ActivityType int
- const (
- ActivityTypeGame ActivityType = 0
- ActivityTypeStreaming ActivityType = 1
- ActivityTypeListening ActivityType = 2
- ActivityTypeWatching ActivityType = 3
- ActivityTypeCustom ActivityType = 4
- ActivityTypeCompeting ActivityType = 5
- )
- type Identify struct {
- Token string `json:"token"`
- Properties IdentifyProperties `json:"properties"`
- Compress bool `json:"compress"`
- LargeThreshold int `json:"large_threshold"`
- Shard *[2]int `json:"shard,omitempty"`
- Presence GatewayStatusUpdate `json:"presence,omitempty"`
- GuildSubscriptions bool `json:"guild_subscriptions"`
- Intents Intent `json:"intents"`
- }
- type IdentifyProperties struct {
- OS string `json:"$os"`
- Browser string `json:"$browser"`
- Device string `json:"$device"`
- Referer string `json:"$referer"`
- ReferringDomain string `json:"$referring_domain"`
- }
- const (
-
- PermissionReadMessages = 0x0000000000000400
- PermissionSendMessages = 0x0000000000000800
- PermissionSendTTSMessages = 0x0000000000001000
- PermissionManageMessages = 0x0000000000002000
- PermissionEmbedLinks = 0x0000000000004000
- PermissionAttachFiles = 0x0000000000008000
- PermissionReadMessageHistory = 0x0000000000010000
- PermissionMentionEveryone = 0x0000000000020000
- PermissionUseExternalEmojis = 0x0000000000040000
- PermissionUseSlashCommands = 0x0000000080000000
- PermissionManageThreads = 0x0000000400000000
- PermissionCreatePublicThreads = 0x0000000800000000
- PermissionCreatePrivateThreads = 0x0000001000000000
- PermissionSendMessagesInThreads = 0x0000004000000000
- )
- const (
- PermissionVoicePrioritySpeaker = 0x0000000000000100
- PermissionVoiceStreamVideo = 0x0000000000000200
- PermissionVoiceConnect = 0x0000000000100000
- PermissionVoiceSpeak = 0x0000000000200000
- PermissionVoiceMuteMembers = 0x0000000000400000
- PermissionVoiceDeafenMembers = 0x0000000000800000
- PermissionVoiceMoveMembers = 0x0000000001000000
- PermissionVoiceUseVAD = 0x0000000002000000
- PermissionVoiceRequestToSpeak = 0x0000000100000000
- )
- const (
- PermissionChangeNickname = 0x0000000004000000
- PermissionManageNicknames = 0x0000000008000000
- PermissionManageRoles = 0x0000000010000000
- PermissionManageWebhooks = 0x0000000020000000
- PermissionManageEmojis = 0x0000000040000000
- )
- const (
- PermissionCreateInstantInvite = 0x0000000000000001
- PermissionKickMembers = 0x0000000000000002
- PermissionBanMembers = 0x0000000000000004
- PermissionAdministrator = 0x0000000000000008
- PermissionManageChannels = 0x0000000000000010
- PermissionManageServer = 0x0000000000000020
- PermissionAddReactions = 0x0000000000000040
- PermissionViewAuditLogs = 0x0000000000000080
- PermissionViewChannel = 0x0000000000000400
- PermissionViewGuildInsights = 0x0000000000080000
- PermissionModerateMembers = 0x0000010000000000
- PermissionAllText = PermissionViewChannel |
- PermissionSendMessages |
- PermissionSendTTSMessages |
- PermissionManageMessages |
- PermissionEmbedLinks |
- PermissionAttachFiles |
- PermissionReadMessageHistory |
- PermissionMentionEveryone
- PermissionAllVoice = PermissionViewChannel |
- PermissionVoiceConnect |
- PermissionVoiceSpeak |
- PermissionVoiceMuteMembers |
- PermissionVoiceDeafenMembers |
- PermissionVoiceMoveMembers |
- PermissionVoiceUseVAD |
- PermissionVoicePrioritySpeaker
- PermissionAllChannel = PermissionAllText |
- PermissionAllVoice |
- PermissionCreateInstantInvite |
- PermissionManageRoles |
- PermissionManageChannels |
- PermissionAddReactions |
- PermissionViewAuditLogs
- PermissionAll = PermissionAllChannel |
- PermissionKickMembers |
- PermissionBanMembers |
- PermissionManageServer |
- PermissionAdministrator |
- PermissionManageWebhooks |
- PermissionManageEmojis
- )
- const (
- ErrCodeGeneralError = 0
- ErrCodeUnknownAccount = 10001
- ErrCodeUnknownApplication = 10002
- ErrCodeUnknownChannel = 10003
- ErrCodeUnknownGuild = 10004
- ErrCodeUnknownIntegration = 10005
- ErrCodeUnknownInvite = 10006
- ErrCodeUnknownMember = 10007
- ErrCodeUnknownMessage = 10008
- ErrCodeUnknownOverwrite = 10009
- ErrCodeUnknownProvider = 10010
- ErrCodeUnknownRole = 10011
- ErrCodeUnknownToken = 10012
- ErrCodeUnknownUser = 10013
- ErrCodeUnknownEmoji = 10014
- ErrCodeUnknownWebhook = 10015
- ErrCodeUnknownWebhookService = 10016
- ErrCodeUnknownSession = 10020
- ErrCodeUnknownBan = 10026
- ErrCodeUnknownSKU = 10027
- ErrCodeUnknownStoreListing = 10028
- ErrCodeUnknownEntitlement = 10029
- ErrCodeUnknownBuild = 10030
- ErrCodeUnknownLobby = 10031
- ErrCodeUnknownBranch = 10032
- ErrCodeUnknownStoreDirectoryLayout = 10033
- ErrCodeUnknownRedistributable = 10036
- ErrCodeUnknownGiftCode = 10038
- ErrCodeUnknownStream = 10049
- ErrCodeUnknownPremiumServerSubscribeCooldown = 10050
- ErrCodeUnknownGuildTemplate = 10057
- ErrCodeUnknownDiscoveryCategory = 10059
- ErrCodeUnknownSticker = 10060
- ErrCodeUnknownInteraction = 10062
- ErrCodeUnknownApplicationCommand = 10063
- ErrCodeUnknownApplicationCommandPermissions = 10066
- ErrCodeUnknownStageInstance = 10067
- ErrCodeUnknownGuildMemberVerificationForm = 10068
- ErrCodeUnknownGuildWelcomeScreen = 10069
- ErrCodeUnknownGuildScheduledEvent = 10070
- ErrCodeUnknownGuildScheduledEventUser = 10071
- ErrCodeBotsCannotUseEndpoint = 20001
- ErrCodeOnlyBotsCanUseEndpoint = 20002
- ErrCodeExplicitContentCannotBeSentToTheDesiredRecipients = 20009
- ErrCodeYouAreNotAuthorizedToPerformThisActionOnThisApplication = 20012
- ErrCodeThisActionCannotBePerformedDueToSlowmodeRateLimit = 20016
- ErrCodeOnlyTheOwnerOfThisAccountCanPerformThisAction = 20018
- ErrCodeMessageCannotBeEditedDueToAnnouncementRateLimits = 20022
- ErrCodeChannelHasHitWriteRateLimit = 20028
- ErrCodeTheWriteActionYouArePerformingOnTheServerHasHitTheWriteRateLimit = 20029
- ErrCodeStageTopicContainsNotAllowedWordsForPublicStages = 20031
- ErrCodeGuildPremiumSubscriptionLevelTooLow = 20035
- ErrCodeMaximumPinsReached = 30003
- ErrCodeMaximumNumberOfRecipientsReached = 30004
- ErrCodeMaximumGuildRolesReached = 30005
- ErrCodeMaximumNumberOfWebhooksReached = 30007
- ErrCodeMaximumNumberOfEmojisReached = 30008
- ErrCodeTooManyReactions = 30010
- ErrCodeMaximumNumberOfGuildChannelsReached = 30013
- ErrCodeMaximumNumberOfAttachmentsInAMessageReached = 30015
- ErrCodeMaximumNumberOfInvitesReached = 30016
- ErrCodeMaximumNumberOfAnimatedEmojisReached = 30018
- ErrCodeMaximumNumberOfServerMembersReached = 30019
- ErrCodeMaximumNumberOfGuildDiscoverySubcategoriesReached = 30030
- ErrCodeGuildAlreadyHasATemplate = 30031
- ErrCodeMaximumNumberOfThreadParticipantsReached = 30033
- ErrCodeMaximumNumberOfBansForNonGuildMembersHaveBeenExceeded = 30035
- ErrCodeMaximumNumberOfBansFetchesHasBeenReached = 30037
- ErrCodeMaximumNumberOfUncompletedGuildScheduledEventsReached = 30038
- ErrCodeMaximumNumberOfStickersReached = 30039
- ErrCodeMaximumNumberOfPruneRequestsHasBeenReached = 30040
- ErrCodeMaximumNumberOfGuildWidgetSettingsUpdatesHasBeenReached = 30042
- ErrCodeMaximumNumberOfEditsToMessagesOlderThanOneHourReached = 30046
- ErrCodeUnauthorized = 40001
- ErrCodeActionRequiredVerifiedAccount = 40002
- ErrCodeOpeningDirectMessagesTooFast = 40003
- ErrCodeSendMessagesHasBeenTemporarilyDisabled = 40004
- ErrCodeRequestEntityTooLarge = 40005
- ErrCodeFeatureTemporarilyDisabledServerSide = 40006
- ErrCodeUserIsBannedFromThisGuild = 40007
- ErrCodeTargetIsNotConnectedToVoice = 40032
- ErrCodeMessageAlreadyCrossposted = 40033
- ErrCodeAnApplicationWithThatNameAlreadyExists = 40041
- ErrCodeInteractionHasAlreadyBeenAcknowledged = 40060
- ErrCodeMissingAccess = 50001
- ErrCodeInvalidAccountType = 50002
- ErrCodeCannotExecuteActionOnDMChannel = 50003
- ErrCodeEmbedDisabled = 50004
- ErrCodeGuildWidgetDisabled = 50004
- ErrCodeCannotEditFromAnotherUser = 50005
- ErrCodeCannotSendEmptyMessage = 50006
- ErrCodeCannotSendMessagesToThisUser = 50007
- ErrCodeCannotSendMessagesInVoiceChannel = 50008
- ErrCodeChannelVerificationLevelTooHigh = 50009
- ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010
- ErrCodeOAuth2ApplicationLimitReached = 50011
- ErrCodeInvalidOAuthState = 50012
- ErrCodeMissingPermissions = 50013
- ErrCodeInvalidAuthenticationToken = 50014
- ErrCodeTooFewOrTooManyMessagesToDelete = 50016
- ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019
- ErrCodeInviteCodeWasEitherInvalidOrTaken = 50020
- ErrCodeCannotExecuteActionOnSystemMessage = 50021
- ErrCodeCannotExecuteActionOnThisChannelType = 50024
- ErrCodeInvalidOAuth2AccessTokenProvided = 50025
- ErrCodeMissingRequiredOAuth2Scope = 50026
- ErrCodeInvalidWebhookTokenProvided = 50027
- ErrCodeInvalidRole = 50028
- ErrCodeInvalidRecipients = 50033
- ErrCodeMessageProvidedTooOldForBulkDelete = 50034
- ErrCodeInvalidFormBody = 50035
- ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036
- ErrCodeInvalidAPIVersionProvided = 50041
- ErrCodeFileUploadedExceedsTheMaximumSize = 50045
- ErrCodeInvalidFileUploaded = 50046
- ErrCodeInvalidGuild = 50055
- ErrCodeInvalidMessageType = 50068
- ErrCodeCannotDeleteAChannelRequiredForCommunityGuilds = 50074
- ErrCodeInvalidStickerSent = 50081
- ErrCodePerformedOperationOnArchivedThread = 50083
- ErrCodeBeforeValueIsEarlierThanThreadCreationDate = 50085
- ErrCodeCommunityServerChannelsMustBeTextChannels = 50086
- ErrCodeThisServerIsNotAvailableInYourLocation = 50095
- ErrCodeThisServerNeedsMonetizationEnabledInOrderToPerformThisAction = 50097
- ErrCodeThisServerNeedsMoreBoostsToPerformThisAction = 50101
- ErrCodeTheRequestBodyContainsInvalidJSON = 50109
- ErrCodeNoUsersWithDiscordTagExist = 80004
- ErrCodeReactionBlocked = 90001
- ErrCodeAPIResourceIsCurrentlyOverloaded = 130000
- ErrCodeTheStageIsAlreadyOpen = 150006
- ErrCodeCannotReplyWithoutPermissionToReadMessageHistory = 160002
- ErrCodeThreadAlreadyCreatedForThisMessage = 160004
- ErrCodeThreadIsLocked = 160005
- ErrCodeMaximumNumberOfActiveThreadsReached = 160006
- ErrCodeMaximumNumberOfActiveAnnouncementThreadsReached = 160007
- ErrCodeInvalidJSONForUploadedLottieFile = 170001
- ErrCodeUploadedLottiesCannotContainRasterizedImages = 170002
- ErrCodeStickerMaximumFramerateExceeded = 170003
- ErrCodeStickerFrameCountExceedsMaximumOfOneThousandFrames = 170004
- ErrCodeLottieAnimationMaximumDimensionsExceeded = 170005
- ErrCodeStickerFrameRateOutOfRange = 170006
- ErrCodeStickerAnimationDurationExceedsMaximumOfFiveSeconds = 170007
- ErrCodeCannotUpdateAFinishedEvent = 180000
- ErrCodeFailedToCreateStageNeededForStageEvent = 180002
- )
- type Intent int
- const (
- IntentGuilds Intent = 1 << 0
- IntentGuildMembers Intent = 1 << 1
- IntentGuildBans Intent = 1 << 2
- IntentGuildEmojis Intent = 1 << 3
- IntentGuildIntegrations Intent = 1 << 4
- IntentGuildWebhooks Intent = 1 << 5
- IntentGuildInvites Intent = 1 << 6
- IntentGuildVoiceStates Intent = 1 << 7
- IntentGuildPresences Intent = 1 << 8
- IntentGuildMessages Intent = 1 << 9
- IntentGuildMessageReactions Intent = 1 << 10
- IntentGuildMessageTyping Intent = 1 << 11
- IntentDirectMessages Intent = 1 << 12
- IntentDirectMessageReactions Intent = 1 << 13
- IntentDirectMessageTyping Intent = 1 << 14
- IntentMessageContent Intent = 1 << 15
- IntentGuildScheduledEvents Intent = 1 << 16
-
- IntentsGuilds Intent = 1 << 0
- IntentsGuildMembers Intent = 1 << 1
- IntentsGuildBans Intent = 1 << 2
- IntentsGuildEmojis Intent = 1 << 3
- IntentsGuildIntegrations Intent = 1 << 4
- IntentsGuildWebhooks Intent = 1 << 5
- IntentsGuildInvites Intent = 1 << 6
- IntentsGuildVoiceStates Intent = 1 << 7
- IntentsGuildPresences Intent = 1 << 8
- IntentsGuildMessages Intent = 1 << 9
- IntentsGuildMessageReactions Intent = 1 << 10
- IntentsGuildMessageTyping Intent = 1 << 11
- IntentsDirectMessages Intent = 1 << 12
- IntentsDirectMessageReactions Intent = 1 << 13
- IntentsDirectMessageTyping Intent = 1 << 14
- IntentsMessageContent Intent = 1 << 15
- IntentsGuildScheduledEvents Intent = 1 << 16
- IntentsAllWithoutPrivileged = IntentGuilds |
- IntentGuildBans |
- IntentGuildEmojis |
- IntentGuildIntegrations |
- IntentGuildWebhooks |
- IntentGuildInvites |
- IntentGuildVoiceStates |
- IntentGuildMessages |
- IntentGuildMessageReactions |
- IntentGuildMessageTyping |
- IntentDirectMessages |
- IntentDirectMessageReactions |
- IntentDirectMessageTyping |
- IntentGuildScheduledEvents
- IntentsAll = IntentsAllWithoutPrivileged |
- IntentGuildMembers |
- IntentGuildPresences |
- IntentMessageContent
- IntentsNone Intent = 0
- )
- func MakeIntent(intents Intent) Intent {
- return intents
- }
|