aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/bwmarrin/discordgo/structs.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/structs.go')
-rw-r--r--vendor/github.com/bwmarrin/discordgo/structs.go514
1 files changed, 373 insertions, 141 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/structs.go b/vendor/github.com/bwmarrin/discordgo/structs.go
index 3a92c9f..26f507a 100644
--- a/vendor/github.com/bwmarrin/discordgo/structs.go
+++ b/vendor/github.com/bwmarrin/discordgo/structs.go
@@ -43,6 +43,9 @@ type Session struct {
// Should the session reconnect the websocket on errors.
ShouldReconnectOnError bool
+ // Should the session retry requests when rate limited.
+ ShouldRetryOnRateLimit bool
+
// Identify is sent during initial handshake with the discord gateway.
// https://discord.com/developers/docs/topics/gateway#identify
Identify Identify
@@ -56,12 +59,12 @@ type Session struct {
ShardCount int
// Should state tracking be enabled.
- // State tracking is the best way for getting the the users
+ // State tracking is the best way for getting the users
// active guilds and the members of the guilds.
StateEnabled bool
// Whether or not to call event handlers synchronously.
- // e.g false = launch event handlers in their own goroutines.
+ // e.g. false = launch event handlers in their own goroutines.
SyncEvents bool
// Exposed but should not be modified by User.
@@ -72,7 +75,7 @@ type Session struct {
// Max number of REST API retries
MaxRestRetries int
- // Status stores the currect status of the websocket connection
+ // Status stores the current status of the websocket connection
// this is being tested, may stay, may go away.
status int32
@@ -92,6 +95,9 @@ type Session struct {
// The http client used for REST requests
Client *http.Client
+ // The dialer used for WebSocket connection
+ Dialer *websocket.Dialer
+
// The user agent used for REST APIs
UserAgent string
@@ -194,23 +200,8 @@ type IntegrationAccount struct {
// A VoiceRegion stores data for a specific voice region server.
type VoiceRegion struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Hostname string `json:"sample_hostname"`
- Port int `json:"sample_port"`
-}
-
-// A VoiceICE stores data for voice ICE servers.
-type VoiceICE struct {
- TTL string `json:"ttl"`
- Servers []*ICEServer `json:"servers"`
-}
-
-// A ICEServer stores data for a specific voice ICE server.
-type ICEServer struct {
- URL string `json:"url"`
- Username string `json:"username"`
- Credential string `json:"credential"`
+ ID string `json:"id"`
+ Name string `json:"name"`
}
// InviteTargetType indicates the type of target of an invite
@@ -219,8 +210,8 @@ type InviteTargetType uint8
// Invite target types
const (
- InviteTargetStream InviteTargetType = 1
- InviteTargetEmbeddedAppliction InviteTargetType = 2
+ InviteTargetStream InviteTargetType = 1
+ InviteTargetEmbeddedApplication InviteTargetType = 2
)
// A Invite stores all data related to a specific Discord Guild or Channel invite.
@@ -243,6 +234,8 @@ type Invite struct {
// will only be filled when using InviteWithCounts
ApproximatePresenceCount int `json:"approximate_presence_count"`
ApproximateMemberCount int `json:"approximate_member_count"`
+
+ ExpiresAt *time.Time `json:"expires_at"`
}
// ChannelType is the type of a Channel
@@ -260,6 +253,7 @@ const (
ChannelTypeGuildNewsThread ChannelType = 10
ChannelTypeGuildPublicThread ChannelType = 11
ChannelTypeGuildPrivateThread ChannelType = 12
+ ChannelTypeGuildStageVoice ChannelType = 13
)
// A Channel holds all data related to an individual Discord channel.
@@ -354,20 +348,20 @@ func (c *Channel) IsThread() bool {
type ChannelEdit struct {
Name string `json:"name,omitempty"`
Topic string `json:"topic,omitempty"`
- NSFW bool `json:"nsfw,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"`
+ RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"`
// NOTE: threads only
- Archived bool `json:"archived,omitempty"`
- AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
- Locked bool `json:"locked,bool"`
- Invitable bool `json:"invitable,omitempty"`
+ Archived *bool `json:"archived,omitempty"`
+ AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
+ Locked *bool `json:"locked,omitempty"`
+ Invitable *bool `json:"invitable,omitempty"`
}
// A ChannelFollow holds data returned after following a news channel
@@ -485,6 +479,17 @@ func (e *Emoji) APIName() string {
return e.ID
}
+// EmojiParams represents parameters needed to create or update an Emoji.
+type EmojiParams struct {
+ // Name of the emoji
+ Name string `json:"name,omitempty"`
+ // A base64 encoded emoji image, has to be smaller than 256KB.
+ // NOTE: can be only set on creation.
+ Image string `json:"image,omitempty"`
+ // Roles for which this emoji will be available.
+ Roles []string `json:"roles,omitempty"`
+}
+
// StickerFormat is the file format of the Sticker.
type StickerFormat int
@@ -552,6 +557,17 @@ const (
ExplicitContentFilterAllMembers ExplicitContentFilterLevel = 2
)
+// GuildNSFWLevel type definition
+type GuildNSFWLevel int
+
+// Constants for GuildNSFWLevel levels from 0 to 3 inclusive
+const (
+ GuildNSFWLevelDefault GuildNSFWLevel = 0
+ GuildNSFWLevelExplicit GuildNSFWLevel = 1
+ GuildNSFWLevelSafe GuildNSFWLevel = 2
+ GuildNSFWLevelAgeRestricted GuildNSFWLevel = 3
+)
+
// MfaLevel type definition
type MfaLevel int
@@ -675,8 +691,11 @@ type Guild struct {
// The explicit content filter level
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"`
+ // The NSFW Level of the guild
+ NSFWLevel GuildNSFWLevel `json:"nsfw_level"`
+
// The list of enabled guild features
- Features []string `json:"features"`
+ Features []GuildFeature `json:"features"`
// Required MFA level for the guild
MfaLevel MfaLevel `json:"mfa_level"`
@@ -731,6 +750,9 @@ type Guild struct {
// Permissions of our user
Permissions int64 `json:"permissions,string"`
+
+ // Stage instances in the guild
+ StageInstances []*StageInstance `json:"stage_instances"`
}
// A GuildPreview holds data related to a specific public Discord Guild, even if the user is not in the guild.
@@ -757,16 +779,31 @@ type GuildPreview struct {
// The list of enabled guild features
Features []string `json:"features"`
- // Approximate number of members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true
+ // Approximate number of members in this guild
+ // NOTE: this field is only filled when using GuildWithCounts
ApproximateMemberCount int `json:"approximate_member_count"`
- // Approximate number of non-offline members in this guild, returned from the GET /guild/<id> endpoint when with_counts is true
+ // Approximate number of non-offline members in this guild
+ // NOTE: this field is only filled when using GuildWithCounts
ApproximatePresenceCount int `json:"approximate_presence_count"`
// the description for the guild
Description string `json:"description"`
}
+// IconURL returns a URL to the guild's icon.
+func (g *GuildPreview) IconURL() string {
+ if g.Icon == "" {
+ return ""
+ }
+
+ if strings.HasPrefix(g.Icon, "a_") {
+ return EndpointGuildIconAnimated(g.ID, g.Icon)
+ }
+
+ return EndpointGuildIcon(g.ID, g.Icon)
+}
+
// GuildScheduledEvent is a representation of a scheduled event in a guild. Only for retrieval of the data.
// https://discord.com/developers/docs/resources/guild-scheduled-event#guild-scheduled-event
type GuildScheduledEvent struct {
@@ -842,7 +879,7 @@ func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
type guildScheduledEventParams GuildScheduledEventParams
if p.EntityType == GuildScheduledEventEntityTypeExternal && p.ChannelID == "" {
- return json.Marshal(struct {
+ return Marshal(struct {
guildScheduledEventParams
ChannelID json.RawMessage `json:"channel_id"`
}{
@@ -851,7 +888,7 @@ func (p GuildScheduledEventParams) MarshalJSON() ([]byte, error) {
})
}
- return json.Marshal(guildScheduledEventParams(p))
+ return Marshal(guildScheduledEventParams(p))
}
// GuildScheduledEventEntityMetadata holds additional metadata for guild scheduled event.
@@ -910,19 +947,19 @@ type GuildScheduledEventUser struct {
Member *Member `json:"member"`
}
-// A GuildTemplate represents
+// A GuildTemplate represents a replicable template for guild creation
type GuildTemplate struct {
// The unique code for the guild template
Code string `json:"code"`
// The name of the template
- Name string `json:"name"`
+ Name string `json:"name,omitempty"`
// The description for the template
- Description string `json:"description"`
+ Description *string `json:"description,omitempty"`
// The number of times this template has been used
- UsageCount string `json:"usage_count"`
+ UsageCount int `json:"usage_count"`
// The ID of the user who created the template
CreatorID string `json:"creator_id"`
@@ -946,6 +983,14 @@ type GuildTemplate struct {
IsDirty bool `json:"is_dirty"`
}
+// GuildTemplateParams stores the data needed to create or update a GuildTemplate.
+type GuildTemplateParams struct {
+ // The name of the template (1-100 characters)
+ Name string `json:"name,omitempty"`
+ // The description of the template (0-120 characters)
+ Description string `json:"description,omitempty"`
+}
+
// MessageNotifications is the notification level for a guild
// https://discord.com/developers/docs/resources/guild#guild-object-default-message-notification-level
type MessageNotifications int
@@ -989,13 +1034,42 @@ func (g *Guild) BannerURL() string {
// A UserGuild holds a brief version of a Guild
type UserGuild struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Icon string `json:"icon"`
- Owner bool `json:"owner"`
- Permissions int64 `json:"permissions,string"`
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Icon string `json:"icon"`
+ Owner bool `json:"owner"`
+ Permissions int64 `json:"permissions,string"`
+ Features []GuildFeature `json:"features"`
}
+// GuildFeature indicates the presence of a feature in a guild
+type GuildFeature string
+
+// Constants for GuildFeature
+const (
+ GuildFeatureAnimatedBanner GuildFeature = "ANIMATED_BANNER"
+ GuildFeatureAnimatedIcon GuildFeature = "ANIMATED_ICON"
+ GuildFeatureAutoModeration GuildFeature = "AUTO_MODERATION"
+ GuildFeatureBanner GuildFeature = "BANNER"
+ GuildFeatureCommunity GuildFeature = "COMMUNITY"
+ GuildFeatureDiscoverable GuildFeature = "DISCOVERABLE"
+ GuildFeatureFeaturable GuildFeature = "FEATURABLE"
+ GuildFeatureInviteSplash GuildFeature = "INVITE_SPLASH"
+ GuildFeatureMemberVerificationGateEnabled GuildFeature = "MEMBER_VERIFICATION_GATE_ENABLED"
+ GuildFeatureMonetizationEnabled GuildFeature = "MONETIZATION_ENABLED"
+ GuildFeatureMoreStickers GuildFeature = "MORE_STICKERS"
+ GuildFeatureNews GuildFeature = "NEWS"
+ GuildFeaturePartnered GuildFeature = "PARTNERED"
+ GuildFeaturePreviewEnabled GuildFeature = "PREVIEW_ENABLED"
+ GuildFeaturePrivateThreads GuildFeature = "PRIVATE_THREADS"
+ GuildFeatureRoleIcons GuildFeature = "ROLE_ICONS"
+ GuildFeatureTicketedEventsEnabled GuildFeature = "TICKETED_EVENTS_ENABLED"
+ GuildFeatureVanityURL GuildFeature = "VANITY_URL"
+ GuildFeatureVerified GuildFeature = "VERIFIED"
+ GuildFeatureVipRegions GuildFeature = "VIP_REGIONS"
+ GuildFeatureWelcomeScreenEnabled GuildFeature = "WELCOME_SCREEN_ENABLED"
+)
+
// A GuildParams stores all the data needed to update discord guild settings
type GuildParams struct {
Name string `json:"name,omitempty"`
@@ -1045,6 +1119,20 @@ func (r *Role) Mention() string {
return fmt.Sprintf("<@&%s>", r.ID)
}
+// RoleParams represents the parameters needed to create or update a Role
+type RoleParams struct {
+ // The role's name
+ Name string `json:"name,omitempty"`
+ // The color the role should have (as a decimal, not hex)
+ Color *int `json:"color,omitempty"`
+ // Whether to display the role's users separately
+ Hoist *bool `json:"hoist,omitempty"`
+ // The overall permissions number of the role
+ Permissions *int64 `json:"permissions,omitempty,string"`
+ // Whether this role is mentionable
+ Mentionable *bool `json:"mentionable,omitempty"`
+}
+
// Roles are a collection of Role
type Roles []*Role
@@ -1062,15 +1150,19 @@ func (r Roles) Swap(i, j int) {
// A VoiceState stores the voice states of Guilds
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"`
+ GuildID string `json:"guild_id"`
+ ChannelID string `json:"channel_id"`
+ UserID string `json:"user_id"`
+ Member *Member `json:"member"`
+ SessionID string `json:"session_id"`
+ Deaf bool `json:"deaf"`
+ Mute bool `json:"mute"`
+ SelfDeaf bool `json:"self_deaf"`
+ SelfMute bool `json:"self_mute"`
+ SelfStream bool `json:"self_stream"`
+ SelfVideo bool `json:"self_video"`
+ Suppress bool `json:"suppress"`
+ RequestToSpeakTimestamp *time.Time `json:"request_to_speak_timestamp"`
}
// A Presence stores the online, offline, or idle and game status of Guild members.
@@ -1093,7 +1185,7 @@ func (t *TimeStamps) UnmarshalJSON(b []byte) error {
End float64 `json:"end,omitempty"`
Start float64 `json:"start,omitempty"`
}{}
- err := json.Unmarshal(b, &temp)
+ err := Unmarshal(b, &temp)
if err != nil {
return err
}
@@ -1170,25 +1262,6 @@ func (m *Member) AvatarURL(size string) string {
}
-// A Settings stores data for a specific users Discord client settings.
-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"`
-}
-
// Status type definition
type Status string
@@ -1201,20 +1274,6 @@ const (
StatusOffline Status = "offline"
)
-// FriendSourceFlags stores ... TODO :)
-type FriendSourceFlags struct {
- All bool `json:"all"`
- MutualGuilds bool `json:"mutual_guilds"`
- MutualFriends bool `json:"mutual_friends"`
-}
-
-// A Relationship between the logged in user and Relationship.User
-type Relationship struct {
- User *User `json:"user"`
- Type int `json:"type"` // 1 = friend, 2 = blocked, 3 = incoming friend req, 4 = sent friend req
- ID string `json:"id"`
-}
-
// A TooManyRequests struct holds information received from Discord
// when receiving a HTTP 429 response.
type TooManyRequests struct {
@@ -1231,7 +1290,7 @@ func (t *TooManyRequests) UnmarshalJSON(b []byte) error {
Message string `json:"message"`
RetryAfter float64 `json:"retry_after"`
}{}
- err := json.Unmarshal(b, &u)
+ err := Unmarshal(b, &u)
if err != nil {
return err
}
@@ -1250,11 +1309,6 @@ type ReadState struct {
ID string `json:"id"`
}
-// An Ack is used to ack messages
-type Ack struct {
- Token string `json:"token"`
-}
-
// A GuildRole stores data for guild roles.
type GuildRole struct {
Role *Role `json:"role"`
@@ -1267,10 +1321,92 @@ type GuildBan struct {
User *User `json:"user"`
}
+// AutoModerationRule stores data for an auto moderation rule.
+type AutoModerationRule struct {
+ ID string `json:"id,omitempty"`
+ GuildID string `json:"guild_id,omitempty"`
+ Name string `json:"name,omitempty"`
+ CreatorID string `json:"creator_id,omitempty"`
+ EventType AutoModerationRuleEventType `json:"event_type,omitempty"`
+ TriggerType AutoModerationRuleTriggerType `json:"trigger_type,omitempty"`
+ TriggerMetadata *AutoModerationTriggerMetadata `json:"trigger_metadata,omitempty"`
+ Actions []AutoModerationAction `json:"actions,omitempty"`
+ Enabled *bool `json:"enabled,omitempty"`
+ ExemptRoles *[]string `json:"exempt_roles,omitempty"`
+ ExemptChannels *[]string `json:"exempt_channels,omitempty"`
+}
+
+// AutoModerationRuleEventType indicates in what event context a rule should be checked.
+type AutoModerationRuleEventType int
+
+// Auto moderation rule event types.
+const (
+ // AutoModerationEventMessageSend is checked when a member sends or edits a message in the guild
+ AutoModerationEventMessageSend AutoModerationRuleEventType = 1
+)
+
+// AutoModerationRuleTriggerType represents the type of content which can trigger the rule.
+type AutoModerationRuleTriggerType int
+
+// Auto moderation rule trigger types.
+const (
+ AutoModerationEventTriggerKeyword AutoModerationRuleTriggerType = 1
+ AutoModerationEventTriggerHarmfulLink AutoModerationRuleTriggerType = 2
+ AutoModerationEventTriggerSpam AutoModerationRuleTriggerType = 3
+ AutoModerationEventTriggerKeywordPreset AutoModerationRuleTriggerType = 4
+)
+
+// AutoModerationKeywordPreset represents an internally pre-defined wordset.
+type AutoModerationKeywordPreset uint
+
+// Auto moderation keyword presets.
+const (
+ AutoModerationKeywordPresetProfanity AutoModerationKeywordPreset = 1
+ AutoModerationKeywordPresetSexualContent AutoModerationKeywordPreset = 2
+ AutoModerationKeywordPresetSlurs AutoModerationKeywordPreset = 3
+)
+
+// AutoModerationTriggerMetadata represents additional metadata used to determine whether rule should be triggered.
+type AutoModerationTriggerMetadata struct {
+ // Substrings which will be searched for in content.
+ // NOTE: should be only used with keyword trigger type.
+ KeywordFilter []string `json:"keyword_filter,omitempty"`
+ // Internally pre-defined wordsets which will be searched for in content.
+ // NOTE: should be only used with keyword preset trigger type.
+ Presets []AutoModerationKeywordPreset `json:"presets,omitempty"`
+}
+
+// AutoModerationActionType represents an action which will execute whenever a rule is triggered.
+type AutoModerationActionType int
+
+// Auto moderation actions types.
+const (
+ AutoModerationRuleActionBlockMessage AutoModerationActionType = 1
+ AutoModerationRuleActionSendAlertMessage AutoModerationActionType = 2
+ AutoModerationRuleActionTimeout AutoModerationActionType = 3
+)
+
+// AutoModerationActionMetadata represents additional metadata needed during execution for a specific action type.
+type AutoModerationActionMetadata struct {
+ // Channel to which user content should be logged.
+ // NOTE: should be only used with send alert message action type.
+ ChannelID string `json:"channel_id,omitempty"`
+
+ // Timeout duration in seconds (maximum of 2419200 - 4 weeks).
+ // NOTE: should be only used with timeout action type.
+ Duration int `json:"duration_seconds,omitempty"`
+}
+
+// AutoModerationAction stores data for an auto moderation action.
+type AutoModerationAction struct {
+ Type AutoModerationActionType `json:"type"`
+ Metadata *AutoModerationActionMetadata `json:"metadata,omitempty"`
+}
+
// A GuildEmbed stores data for a guild embed.
type GuildEmbed struct {
- Enabled bool `json:"enabled"`
- ChannelID string `json:"channel_id"`
+ Enabled *bool `json:"enabled,omitempty"`
+ ChannelID string `json:"channel_id,omitempty"`
}
// A GuildAuditLog stores data for a guild audit log.
@@ -1538,32 +1674,79 @@ const (
AuditLogActionThreadCreate AuditLogAction = 110
AuditLogActionThreadUpdate AuditLogAction = 111
AuditLogActionThreadDelete AuditLogAction = 112
+
+ AuditLogActionApplicationCommandPermissionUpdate AuditLogAction = 121
)
-// A UserGuildSettingsChannelOverride stores data for a channel override for a users guild settings.
-type UserGuildSettingsChannelOverride struct {
- Muted bool `json:"muted"`
- MessageNotifications int `json:"message_notifications"`
- ChannelID string `json:"channel_id"`
-}
+// GuildMemberParams stores data needed to update a member
+// https://discord.com/developers/docs/resources/guild#modify-guild-member
+type GuildMemberParams struct {
+ // Value to set user's nickname to.
+ Nick string `json:"nick,omitempty"`
+ // Array of role ids the member is assigned.
+ Roles *[]string `json:"roles,omitempty"`
+ // ID of channel to move user to (if they are connected to voice).
+ // Set to "" to remove user from a voice channel.
+ ChannelID *string `json:"channel_id,omitempty"`
+ // Whether the user is muted in voice channels.
+ Mute *bool `json:"mute,omitempty"`
+ // Whether the user is deafened in voice channels.
+ Deaf *bool `json:"deaf,omitempty"`
+ // When the user's timeout will expire and the user will be able
+ // to communicate in the guild again (up to 28 days in the future).
+ // Set to time.Time{} to remove timeout.
+ CommunicationDisabledUntil *time.Time `json:"communication_disabled_until,omitempty"`
+}
+
+// MarshalJSON is a helper function to marshal GuildMemberParams.
+func (p GuildMemberParams) MarshalJSON() (res []byte, err error) {
+ type guildMemberParams GuildMemberParams
+ v := struct {
+ guildMemberParams
+ ChannelID json.RawMessage `json:"channel_id,omitempty"`
+ CommunicationDisabledUntil json.RawMessage `json:"communication_disabled_until,omitempty"`
+ }{guildMemberParams: guildMemberParams(p)}
+
+ if p.ChannelID != nil {
+ if *p.ChannelID == "" {
+ v.ChannelID = json.RawMessage(`null`)
+ } else {
+ res, err = json.Marshal(p.ChannelID)
+ if err != nil {
+ return
+ }
+ v.ChannelID = res
+ }
+ }
+
+ if p.CommunicationDisabledUntil != nil {
+ if p.CommunicationDisabledUntil.IsZero() {
+ v.CommunicationDisabledUntil = json.RawMessage(`null`)
+ } else {
+ res, err = json.Marshal(p.CommunicationDisabledUntil)
+ if err != nil {
+ return
+ }
+ v.CommunicationDisabledUntil = res
+ }
+ }
-// A UserGuildSettings stores data for a users guild settings.
-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"`
+ return json.Marshal(v)
}
-// A UserGuildSettingsEdit stores data for editing UserGuildSettings
-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"`
+// GuildMemberAddParams stores data needed to add a user to a guild.
+// NOTE: All fields are optional, except AccessToken.
+type GuildMemberAddParams struct {
+ // Valid access_token for the user.
+ AccessToken string `json:"access_token"`
+ // Value to set users nickname to.
+ Nick string `json:"nick,omitempty"`
+ // A list of role ID's to set on the member.
+ Roles []string `json:"roles,omitempty"`
+ // Whether the user is muted.
+ Mute bool `json:"mute,omitempty"`
+ // Whether the user is deafened.
+ Deaf bool `json:"deaf,omitempty"`
}
// An APIErrorMessage is an api error message returned from discord
@@ -1642,7 +1825,7 @@ func (activity *Activity) UnmarshalJSON(b []byte) error {
Instance bool `json:"instance,omitempty"`
Flags int `json:"flags,omitempty"`
}{}
- err := json.Unmarshal(b, &temp)
+ err := Unmarshal(b, &temp)
if err != nil {
return err
}
@@ -1695,14 +1878,13 @@ const (
// Identify is sent during initial handshake with the discord gateway.
// https://discord.com/developers/docs/topics/gateway#identify
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"`
+ 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"`
+ Intents Intent `json:"intents"`
}
// IdentifyProperties contains the "properties" portion of an Identify packet
@@ -1715,6 +1897,49 @@ type IdentifyProperties struct {
ReferringDomain string `json:"$referring_domain"`
}
+// StageInstance holds information about a live stage.
+// https://discord.com/developers/docs/resources/stage-instance#stage-instance-resource
+type StageInstance struct {
+ // The id of this Stage instance
+ ID string `json:"id"`
+ // The guild id of the associated Stage channel
+ GuildID string `json:"guild_id"`
+ // The id of the associated Stage channel
+ ChannelID string `json:"channel_id"`
+ // The topic of the Stage instance (1-120 characters)
+ Topic string `json:"topic"`
+ // The privacy level of the Stage instance
+ // https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
+ PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level"`
+ // Whether or not Stage Discovery is disabled (deprecated)
+ DiscoverableDisabled bool `json:"discoverable_disabled"`
+ // The id of the scheduled event for this Stage instance
+ GuildScheduledEventID string `json:"guild_scheduled_event_id"`
+}
+
+// StageInstanceParams represents the parameters needed to create or edit a stage instance
+type StageInstanceParams struct {
+ // ChannelID represents the id of the Stage channel
+ ChannelID string `json:"channel_id,omitempty"`
+ // Topic of the Stage instance (1-120 characters)
+ Topic string `json:"topic,omitempty"`
+ // PrivacyLevel of the Stage instance (default GUILD_ONLY)
+ PrivacyLevel StageInstancePrivacyLevel `json:"privacy_level,omitempty"`
+ // SendStartNotification will notify @everyone that a Stage instance has started
+ SendStartNotification bool `json:"send_start_notification,omitempty"`
+}
+
+// StageInstancePrivacyLevel represents the privacy level of a Stage instance
+// https://discord.com/developers/docs/resources/stage-instance#stage-instance-object-privacy-level
+type StageInstancePrivacyLevel int
+
+const (
+ // StageInstancePrivacyLevelPublic The Stage instance is visible publicly. (deprecated)
+ StageInstancePrivacyLevelPublic StageInstancePrivacyLevel = 1
+ // StageInstancePrivacyLevelGuildOnly The Stage instance is visible to only guild members.
+ StageInstancePrivacyLevelGuildOnly StageInstancePrivacyLevel = 2
+)
+
// Constants for the different bit offsets of text channel permissions
const (
// Deprecated: PermissionReadMessages has been replaced with PermissionViewChannel for text and voice channels
@@ -1731,6 +1956,7 @@ const (
PermissionManageThreads = 0x0000000400000000
PermissionCreatePublicThreads = 0x0000000800000000
PermissionCreatePrivateThreads = 0x0000001000000000
+ PermissionUseExternalStickers = 0x0000002000000000
PermissionSendMessagesInThreads = 0x0000004000000000
)
@@ -1745,6 +1971,7 @@ const (
PermissionVoiceMoveMembers = 0x0000000001000000
PermissionVoiceUseVAD = 0x0000000002000000
PermissionVoiceRequestToSpeak = 0x0000000100000000
+ PermissionUseActivities = 0x0000008000000000
)
// Constants for general management.
@@ -1754,6 +1981,7 @@ const (
PermissionManageRoles = 0x0000000010000000
PermissionManageWebhooks = 0x0000000020000000
PermissionManageEmojis = 0x0000000040000000
+ PermissionManageEvents = 0x0000000200000000
)
// Constants for the different bit offsets of general permissions
@@ -1969,23 +2197,25 @@ type Intent int
// Constants for the different bit offsets of intents
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
+ 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
+ IntentAutoModerationConfiguration Intent = 1 << 20
+ IntentAutoModerationExecution Intent = 1 << 21
// TODO: remove when compatibility is not needed
@@ -2020,7 +2250,9 @@ const (
IntentDirectMessages |
IntentDirectMessageReactions |
IntentDirectMessageTyping |
- IntentGuildScheduledEvents
+ IntentGuildScheduledEvents |
+ IntentAutoModerationConfiguration |
+ IntentAutoModerationExecution
IntentsAll = IntentsAllWithoutPrivileged |
IntentGuildMembers |