1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327 |
- package discordgo
- import (
- "encoding/json"
- "fmt"
- "net/http"
- "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 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 Timestamp `json:"synced_at"`
- }
- type ExpireBehavior int
- const (
- ExpireBehaviorRemoveRole ExpireBehavior = iota
- ExpireBehaviorKick
- )
- 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 Invite struct {
- Guild *Guild `json:"guild"`
- Channel *Channel `json:"channel"`
- Inviter *User `json:"inviter"`
- Code string `json:"code"`
- CreatedAt Timestamp `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"`
- TargetUserType TargetUserType `json:"target_user_type"`
-
- ApproximatePresenceCount int `json:"approximate_presence_count"`
- ApproximateMemberCount int `json:"approximate_member_count"`
- }
- type TargetUserType int
- const (
- TargetUserTypeStream TargetUserType = iota
- )
- type ChannelType int
- const (
- ChannelTypeGuildText ChannelType = iota
- ChannelTypeDM
- ChannelTypeGuildVoice
- ChannelTypeGroupDM
- ChannelTypeGuildCategory
- ChannelTypeGuildNews
- ChannelTypeGuildStore
- )
- 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 Timestamp `json:"last_pin_timestamp"`
-
- 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"`
- }
- func (c *Channel) Mention() string {
- return fmt.Sprintf("<#%s>", c.ID)
- }
- 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"`
- }
- type PermissionOverwrite struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Deny int `json:"deny"`
- Allow int `json:"allow"`
- }
- 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"`
- }
- 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 VerificationLevel int
- const (
- VerificationLevelNone VerificationLevel = iota
- VerificationLevelLow
- VerificationLevelMedium
- VerificationLevelHigh
- VerificationLevelVeryHigh
- )
- type ExplicitContentFilterLevel int
- const (
- ExplicitContentFilterDisabled ExplicitContentFilterLevel = iota
- ExplicitContentFilterMembersWithoutRoles
- ExplicitContentFilterAllMembers
- )
- type MfaLevel int
- const (
- MfaLevelNone MfaLevel = iota
- MfaLevelElevated
- )
- type PremiumTier int
- const (
- PremiumTierNone PremiumTier = iota
- PremiumTier1
- PremiumTier2
- PremiumTier3
- )
- 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"`
-
- EmbedChannelID string `json:"embed_channel_id"`
-
- OwnerID string `json:"owner_id"`
-
- Owner bool `json:"owner"`
-
-
-
- JoinedAt Timestamp `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"`
-
- EmbedEnabled bool `json:"embed_enabled"`
-
-
-
- Large bool `json:"large"`
-
- DefaultMessageNotifications MessageNotifications `json:"default_message_notifications"`
-
- Roles []*Role `json:"roles"`
-
- Emojis []*Emoji `json:"emojis"`
-
-
-
- Members []*Member `json:"members"`
-
-
-
- Presences []*Presence `json:"presences"`
-
- MaxPresences int `json:"max_presences"`
-
- MaxMembers int `json:"max_members"`
-
-
-
- Channels []*Channel `json:"channels"`
-
-
-
- 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 int `json:"permissions"`
- }
- type MessageNotifications int
- const (
- MessageNotificationsAllMessages MessageNotifications = iota
- MessageNotificationsOnlyMentions
- )
- type SystemChannelFlag int
- const (
- SystemChannelFlagsSuppressJoin SystemChannelFlag = 1 << iota
- SystemChannelFlagsSuppressPremium
- )
- 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)
- }
- type UserGuild struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Icon string `json:"icon"`
- Owner bool `json:"owner"`
- Permissions int `json:"permissions"`
- }
- 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"`
- }
- 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 int `json:"permissions"`
- }
- 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"`
- Game *Game `json:"game"`
- Activities []*Game `json:"activities"`
- Nick string `json:"nick"`
- Roles []string `json:"roles"`
- Since *int `json:"since"`
- }
- type GameType int
- const (
- GameTypeGame GameType = iota
- GameTypeStreaming
- GameTypeListening
- GameTypeWatching
- GameTypeCustom
- )
- type Game struct {
- Name string `json:"name"`
- Type GameType `json:"type"`
- URL string `json:"url,omitempty"`
- Details string `json:"details,omitempty"`
- State string `json:"state,omitempty"`
- TimeStamps TimeStamps `json:"timestamps,omitempty"`
- Assets Assets `json:"assets,omitempty"`
- ApplicationID string `json:"application_id,omitempty"`
- Instance int8 `json:"instance,omitempty"`
-
- }
- 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 Timestamp `json:"joined_at"`
-
- Nick string `json:"nick"`
-
- Deaf bool `json:"deaf"`
-
- Mute bool `json:"mute"`
-
- User *User `json:"user"`
-
- Roles []string `json:"roles"`
-
- PremiumSince Timestamp `json:"premium_since"`
- }
- func (m *Member) Mention() string {
- return "<@!" + m.User.ID + ">"
- }
- 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"`
- }
- 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 (
- AuditLogChangeKeyName AuditLogChangeKey = "name"
- AuditLogChangeKeyIconHash AuditLogChangeKey = "icon_hash"
- AuditLogChangeKeySplashHash AuditLogChangeKey = "splash_hash"
- AuditLogChangeKeyOwnerID AuditLogChangeKey = "owner_id"
- AuditLogChangeKeyRegion AuditLogChangeKey = "region"
- AuditLogChangeKeyAfkChannelID AuditLogChangeKey = "afk_channel_id"
- AuditLogChangeKeyAfkTimeout AuditLogChangeKey = "afk_timeout"
- AuditLogChangeKeyMfaLevel AuditLogChangeKey = "mfa_level"
- AuditLogChangeKeyVerificationLevel AuditLogChangeKey = "verification_level"
- AuditLogChangeKeyExplicitContentFilter AuditLogChangeKey = "explicit_content_filter"
- AuditLogChangeKeyDefaultMessageNotification AuditLogChangeKey = "default_message_notifications"
- AuditLogChangeKeyVanityURLCode AuditLogChangeKey = "vanity_url_code"
- AuditLogChangeKeyRoleAdd AuditLogChangeKey = "$add"
- AuditLogChangeKeyRoleRemove AuditLogChangeKey = "$remove"
- AuditLogChangeKeyPruneDeleteDays AuditLogChangeKey = "prune_delete_days"
- AuditLogChangeKeyWidgetEnabled AuditLogChangeKey = "widget_enabled"
- AuditLogChangeKeyWidgetChannelID AuditLogChangeKey = "widget_channel_id"
- AuditLogChangeKeySystemChannelID AuditLogChangeKey = "system_channel_id"
- AuditLogChangeKeyPosition AuditLogChangeKey = "position"
- AuditLogChangeKeyTopic AuditLogChangeKey = "topic"
- AuditLogChangeKeyBitrate AuditLogChangeKey = "bitrate"
- AuditLogChangeKeyPermissionOverwrite AuditLogChangeKey = "permission_overwrites"
- AuditLogChangeKeyNSFW AuditLogChangeKey = "nsfw"
- AuditLogChangeKeyApplicationID AuditLogChangeKey = "application_id"
- AuditLogChangeKeyRateLimitPerUser AuditLogChangeKey = "rate_limit_per_user"
- AuditLogChangeKeyPermissions AuditLogChangeKey = "permissions"
- AuditLogChangeKeyColor AuditLogChangeKey = "color"
- AuditLogChangeKeyHoist AuditLogChangeKey = "hoist"
- AuditLogChangeKeyMentionable AuditLogChangeKey = "mentionable"
- AuditLogChangeKeyAllow AuditLogChangeKey = "allow"
- AuditLogChangeKeyDeny AuditLogChangeKey = "deny"
- AuditLogChangeKeyCode AuditLogChangeKey = "code"
- AuditLogChangeKeyChannelID AuditLogChangeKey = "channel_id"
- AuditLogChangeKeyInviterID AuditLogChangeKey = "inviter_id"
- AuditLogChangeKeyMaxUses AuditLogChangeKey = "max_uses"
- AuditLogChangeKeyUses AuditLogChangeKey = "uses"
- AuditLogChangeKeyMaxAge AuditLogChangeKey = "max_age"
- AuditLogChangeKeyTempoary AuditLogChangeKey = "temporary"
- AuditLogChangeKeyDeaf AuditLogChangeKey = "deaf"
- AuditLogChangeKeyMute AuditLogChangeKey = "mute"
- AuditLogChangeKeyNick AuditLogChangeKey = "nick"
- AuditLogChangeKeyAvatarHash AuditLogChangeKey = "avatar_hash"
- AuditLogChangeKeyID AuditLogChangeKey = "id"
- AuditLogChangeKeyType AuditLogChangeKey = "type"
- AuditLogChangeKeyEnableEmoticons AuditLogChangeKey = "enable_emoticons"
- AuditLogChangeKeyExpireBehavior AuditLogChangeKey = "expire_behavior"
- AuditLogChangeKeyExpireGracePeriod AuditLogChangeKey = "expire_grace_period"
- )
- 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
- 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
- )
- 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 Webhook struct {
- ID string `json:"id"`
- Type WebhookType `json:"type"`
- GuildID string `json:"guild_id"`
- ChannelID string `json:"channel_id"`
- User *User `json:"user"`
- Name string `json:"name"`
- Avatar string `json:"avatar"`
- Token string `json:"token"`
- }
- type WebhookType int
- const (
- WebhookTypeIncoming WebhookType = iota
- WebhookTypeChannelFollower
- )
- type WebhookParams struct {
- Content string `json:"content,omitempty"`
- Username string `json:"username,omitempty"`
- AvatarURL string `json:"avatar_url,omitempty"`
- TTS bool `json:"tts,omitempty"`
- File string `json:"file,omitempty"`
- Embeds []*MessageEmbed `json:"embeds,omitempty"`
- AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
- }
- 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"`
- }
- type GatewayStatusUpdate struct {
- Since int `json:"since"`
- Game Activity `json:"game"`
- Status string `json:"status"`
- AFK bool `json:"afk"`
- }
- type Activity struct {
- Name string
- Type ActivityType
- URL string
- }
- type ActivityType int
- const (
- ActivityTypeGame GameType = iota
- ActivityTypeStreaming
- ActivityTypeListening
-
- ActivityTypeCustom = 4
- )
- 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,omitempty"`
- }
- 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 = 1 << (iota + 10)
- PermissionSendMessages
- PermissionSendTTSMessages
- PermissionManageMessages
- PermissionEmbedLinks
- PermissionAttachFiles
- PermissionReadMessageHistory
- PermissionMentionEveryone
- PermissionUseExternalEmojis
- )
- const (
- PermissionVoiceConnect = 1 << (iota + 20)
- PermissionVoiceSpeak
- PermissionVoiceMuteMembers
- PermissionVoiceDeafenMembers
- PermissionVoiceMoveMembers
- PermissionVoiceUseVAD
- PermissionVoicePrioritySpeaker = 1 << (iota + 2)
- )
- const (
- PermissionChangeNickname = 1 << (iota + 26)
- PermissionManageNicknames
- PermissionManageRoles
- PermissionManageWebhooks
- PermissionManageEmojis
- )
- const (
- PermissionCreateInstantInvite = 1 << iota
- PermissionKickMembers
- PermissionBanMembers
- PermissionAdministrator
- PermissionManageChannels
- PermissionManageServer
- PermissionAddReactions
- PermissionViewAuditLogs
- PermissionViewChannel = 1 << (iota + 2)
- 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 (
- 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
- ErrCodeBotsCannotUseEndpoint = 20001
- ErrCodeOnlyBotsCanUseEndpoint = 20002
- ErrCodeMaximumGuildsReached = 30001
- ErrCodeMaximumFriendsReached = 30002
- ErrCodeMaximumPinsReached = 30003
- ErrCodeMaximumGuildRolesReached = 30005
- ErrCodeTooManyReactions = 30010
- ErrCodeUnauthorized = 40001
- ErrCodeMissingAccess = 50001
- ErrCodeInvalidAccountType = 50002
- ErrCodeCannotExecuteActionOnDMChannel = 50003
- ErrCodeEmbedDisabled = 50004
- ErrCodeCannotEditFromAnotherUser = 50005
- ErrCodeCannotSendEmptyMessage = 50006
- ErrCodeCannotSendMessagesToThisUser = 50007
- ErrCodeCannotSendMessagesInVoiceChannel = 50008
- ErrCodeChannelVerificationLevelTooHigh = 50009
- ErrCodeOAuth2ApplicationDoesNotHaveBot = 50010
- ErrCodeOAuth2ApplicationLimitReached = 50011
- ErrCodeInvalidOAuthState = 50012
- ErrCodeMissingPermissions = 50013
- ErrCodeInvalidAuthenticationToken = 50014
- ErrCodeNoteTooLong = 50015
- ErrCodeTooFewOrTooManyMessagesToDelete = 50016
- ErrCodeCanOnlyPinMessageToOriginatingChannel = 50019
- ErrCodeCannotExecuteActionOnSystemMessage = 50021
- ErrCodeMessageProvidedTooOldForBulkDelete = 50034
- ErrCodeInvalidFormBody = 50035
- ErrCodeInviteAcceptedToGuildApplicationsBotNotIn = 50036
- ErrCodeReactionBlocked = 90001
- )
- type Intent int
- const (
- IntentsGuilds Intent = 1 << iota
- IntentsGuildMembers
- IntentsGuildBans
- IntentsGuildEmojis
- IntentsGuildIntegrations
- IntentsGuildWebhooks
- IntentsGuildInvites
- IntentsGuildVoiceStates
- IntentsGuildPresences
- IntentsGuildMessages
- IntentsGuildMessageReactions
- IntentsGuildMessageTyping
- IntentsDirectMessages
- IntentsDirectMessageReactions
- IntentsDirectMessageTyping
- IntentsAllWithoutPrivileged = IntentsGuilds |
- IntentsGuildBans |
- IntentsGuildEmojis |
- IntentsGuildIntegrations |
- IntentsGuildWebhooks |
- IntentsGuildInvites |
- IntentsGuildVoiceStates |
- IntentsGuildMessages |
- IntentsGuildMessageReactions |
- IntentsGuildMessageTyping |
- IntentsDirectMessages |
- IntentsDirectMessageReactions |
- IntentsDirectMessageTyping
- IntentsAll = IntentsAllWithoutPrivileged |
- IntentsGuildMembers |
- IntentsGuildPresences
- IntentsNone Intent = 0
- )
- func MakeIntent(intents Intent) *Intent {
- return &intents
- }
|