123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037 |
- 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 GuildScheduledEvent struct {
-
- ID string `json:"id"`
-
- GuildID string `json:"guild_id"`
-
- ChannelID string `json:"channel_id"`
-
- CreatorID string `json:"creator_id"`
-
- Name string `json:"name"`
-
- Description string `json:"description"`
-
- ScheduledStartTime time.Time `json:"scheduled_start_time"`
-
- ScheduledEndTime *time.Time `json:"scheduled_end_time"`
-
- PrivacyLevel GuildScheduledEventPrivacyLevel `json:"privacy_level"`
-
- Status GuildScheduledEventStatus `json:"status"`
-
-
-
- EntityType GuildScheduledEventEntityType `json:"entity_type"`
-
- EntityID string `json:"entity_id"`
-
- EntityMetadata GuildScheduledEventEntityMetadata `json:"entity_metadata"`
-
- Creator *User `json:"creator"`
-
- UserCount int `json:"user_count"`
-
-
-
- Image string `json:"image"`
- }
- type GuildScheduledEventParams struct {
-
- ChannelID string `json:"channel_id,omitempty"`
-
- Name string `json:"name,omitempty"`
-
- Description string `json:"description,omitempty"`
-
- ScheduledStartTime *time.Time `json:"scheduled_start_time,omitempty"`
-
- ScheduledEndTime *time.Time `json:"scheduled_end_time,omitempty"`
-
- PrivacyLevel GuildScheduledEventPrivacyLevel `json:"privacy_level,omitempty"`
-
- Status GuildScheduledEventStatus `json:"status,omitempty"`
-
-
-
- EntityType GuildScheduledEventEntityType `json:"entity_type,omitempty"`
-
- EntityMetadata *GuildScheduledEventEntityMetadata `json:"entity_metadata,omitempty"`
-
-
-
- Image string `json:"image,omitempty"`
- }
- func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
- type guildScheduledEventParams GuildScheduledEventParams
- if p.EntityType == GuildScheduledEventEntityTypeExternal && p.ChannelID == "" {
- return json.Marshal(struct {
- guildScheduledEventParams
- ChannelID json.RawMessage `json:"channel_id"`
- }{
- guildScheduledEventParams: guildScheduledEventParams(p),
- ChannelID: json.RawMessage("null"),
- })
- }
- return json.Marshal(guildScheduledEventParams(p))
- }
- type GuildScheduledEventEntityMetadata struct {
-
-
- Location string `json:"location"`
- }
- type GuildScheduledEventPrivacyLevel int
- const (
-
-
- GuildScheduledEventPrivacyLevelGuildOnly GuildScheduledEventPrivacyLevel = 2
- )
- type GuildScheduledEventStatus int
- const (
-
- GuildScheduledEventStatusScheduled = 1
-
- GuildScheduledEventStatusActive = 2
-
- GuildScheduledEventStatusCompleted = 3
-
- GuildScheduledEventStatusCanceled = 4
- )
- type GuildScheduledEventEntityType int
- const (
-
- GuildScheduledEventEntityTypeStageInstance = 1
-
- GuildScheduledEventEntityTypeVoice = 2
-
- GuildScheduledEventEntityTypeExternal = 3
- )
- type GuildScheduledEventUser struct {
- GuildScheduledEventID string `json:"guild_scheduled_event_id"`
- User *User `json:"user"`
- Member *Member `json:"member"`
- }
- 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
- }
|