Skip to content

Commit 1217267

Browse files
committed
Updates
* update to current docs (4/11/2023) * update deps * add `0` permission so certain things don't break Signed-off-by: Keith Russo <[email protected]>
1 parent b9bb78e commit 1217267

File tree

11 files changed

+167
-99
lines changed

11 files changed

+167
-99
lines changed

api/application.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,16 @@ type ApplicationFlags int64
5050

5151
//goland:noinspection GoUnusedConst
5252
const (
53-
GatewayPresence ApplicationFlags = 1 << 12 // Intent required for bots in 100 or more servers to receive presence_update events
54-
GatewayPresenceLimited ApplicationFlags = 1 << 13 // Intent required for bots in under 100 servers to receive presence_update events, found in Bot Settings
55-
GatewayGuildMembers ApplicationFlags = 1 << 14 // Intent required for bots in 100 or more servers to receive member-related events like guild_member_add. See list of member-related events under GUILD_MEMBERS
56-
GatewayGuildMembersLimited ApplicationFlags = 1 << 15 // Intent required for bots in under 100 servers to receive member-related events like guild_member_add, found in Bot Settings. See list of member-related events under GUILD_MEMBERS
57-
VerificationPendingGuildLimit ApplicationFlags = 1 << 16 // Indicates unusual growth of an app that prevents verification
58-
Embedded ApplicationFlags = 1 << 17 // Indicates if an app is embedded within the Discord client (currently unavailable publicly)
59-
GatewayMessageContent ApplicationFlags = 1 << 18 // Intent required for bots in 100 or more servers to receive message content
60-
GatewayMessageContentLimited ApplicationFlags = 1 << 19 // Intent required for bots in under 100 servers to receive message content, found in Bot Settings
61-
ApplicationCommandBadge ApplicationFlags = 1 << 23 // Indicates if an app has registered global application commands
53+
ApplicationAutoModerationRuleCreateBadge ApplicationFlags = 1 << 6 // Indicates if an app uses the Auto Moderation API
54+
GatewayPresence ApplicationFlags = 1 << 12 // Intent required for bots in 100 or more servers to receive presence_update events
55+
GatewayPresenceLimited ApplicationFlags = 1 << 13 // Intent required for bots in under 100 servers to receive presence_update events, found in Bot Settings
56+
GatewayGuildMembers ApplicationFlags = 1 << 14 // Intent required for bots in 100 or more servers to receive member-related events like guild_member_add. See list of member-related events under GUILD_MEMBERS
57+
GatewayGuildMembersLimited ApplicationFlags = 1 << 15 // Intent required for bots in under 100 servers to receive member-related events like guild_member_add, found in Bot Settings. See list of member-related events under GUILD_MEMBERS
58+
VerificationPendingGuildLimit ApplicationFlags = 1 << 16 // Indicates unusual growth of an app that prevents verification
59+
Embedded ApplicationFlags = 1 << 17 // Indicates if an app is embedded within the Discord client (currently unavailable publicly)
60+
GatewayMessageContent ApplicationFlags = 1 << 18 // Intent required for bots in 100 or more servers to receive message content
61+
GatewayMessageContentLimited ApplicationFlags = 1 << 19 // Intent required for bots in under 100 servers to receive message content, found in Bot Settings
62+
ApplicationCommandBadge ApplicationFlags = 1 << 23 // Indicates if an app has registered global application commands
6263
)
6364

6465
// InstallParams - settings for the application's default in-app authorization link, if enabled

api/guild.go

+77-38
Original file line numberDiff line numberDiff line change
@@ -22,44 +22,45 @@ import (
2222

2323
// Guild - Guilds in Discord represent an isolated collection of users and channels, and are often referred to as "servers" in the UI.
2424
type Guild struct {
25-
ID Snowflake `json:"id"` // guild id
26-
Name string `json:"name"` // guild name (2-100 characters, excluding trailing and leading whitespace)
27-
Icon *string `json:"icon"` // icon hash
28-
IconHash *string `json:"icon_hash,omitempty"` // icon hash, returned when in the template object
29-
Splash *string `json:"splash,omitempty"` // splash hash
30-
DiscoverySplash *string `json:"discovery_splash"` // discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
31-
OwnerID Snowflake `json:"owner_id"` // id of owner
32-
AfkChannelID Snowflake `json:"afk_channel_id,omitempty"` // id of afk channel
33-
AfkTimeout int `json:"afk_timeout"` // afk timeout in seconds
34-
WidgetEnabled bool `json:"widget_enabled,omitempty"` // true if the server widget is enabled
35-
WidgetChannelID *Snowflake `json:"widget_channel_id,omitempty"` // the channel id that the widget will generate an "invite" to, or null if set to no invite
36-
VerificationLevel VerificationLevel `json:"verification_level"` // verification level required for the guild
37-
DefaultMessageNotifications DefaultMessageNotificationLevel `json:"default_message_notifications"` // default message notifications level
38-
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"` // explicit content filter level
39-
Roles []*Role `json:"roles"` // roles in the guild
40-
Emojis []*Emoji `json:"emojis"` // custom guild emojis
41-
Features []*GuildFeatures `json:"features"` // enabled guild features
42-
MfaLevel MfaLevel `json:"mfa_level"` // required MFA level for the guild
43-
ApplicationID *Snowflake `json:"application_id"` // application id of the guild creator if it is bot-created
44-
SystemChannelID *Snowflake `json:"system_channel_id"` // the id of the channel where guild notices such as welcome messages and boost events are posted
45-
SystemChannelFlags SystemChannelFlags `json:"system_channel_flags"` // system channel flags
46-
RulesChannelID *Snowflake `json:"rules_channel_id"` // the id of the channel where Community guilds can display rules and/or guidelines
47-
MaxPresences *int64 `json:"max_presences,omitempty"` // the maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
48-
MaxMembers int64 `json:"max_members,omitempty"` // the maximum number of members for the guild
49-
VanityUrlCode *string `json:"vanity_url_code"` // the vanity url code for the guild
50-
Description *string `json:"description"` // the description of a Community guild
51-
Banner *string `json:"banner"` // banner hash
52-
PremiumTier PremiumTier `json:"premium_tier"` // premium tier (Server Boost level)
53-
PremiumSubscriptionCount uint64 `json:"premium_subscription_count,omitempty"` // the number of boosts this guild currently has
54-
PreferredLocale string `json:"preferred_locale"` // the preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
55-
PublicUpdatesChannelID *Snowflake `json:"public_updates_channel_id"` // the id of the channel where admins and moderators of Community guilds receive notices from Discord
56-
MaxVideoChannelUsers uint64 `json:"max_video_channel_users,omitempty"` // the maximum amount of users in a video channel
57-
ApproximateMemberCount uint64 `json:"approximate_member_count,omitempty"` // approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
58-
ApproximatePresenceCount uint64 `json:"approximate_presence_count,omitempty"` // approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
59-
WelcomeScreen WelcomeScreen `json:"welcome_screen,omitempty"` // the welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
60-
NsfwLevel GuildNsfwLevel `json:"nsfw_level"` // guild NSFW level
61-
Stickers []*Sticker `json:"stickers,omitempty"` // custom guild stickers
62-
PremiumProgressBarEnabled bool `json:"premium_progress_bar_enabled"` // whether the guild has the boost progress bar enabled
25+
ID Snowflake `json:"id"` // guild id
26+
Name string `json:"name"` // guild name (2-100 characters, excluding trailing and leading whitespace)
27+
Icon *string `json:"icon"` // icon hash
28+
IconHash *string `json:"icon_hash,omitempty"` // icon hash, returned when in the template object
29+
Splash *string `json:"splash,omitempty"` // splash hash
30+
DiscoverySplash *string `json:"discovery_splash"` // discovery splash hash; only present for guilds with the "DISCOVERABLE" feature
31+
OwnerID Snowflake `json:"owner_id"` // id of owner
32+
AfkChannelID Snowflake `json:"afk_channel_id,omitempty"` // id of afk channel
33+
AfkTimeout int `json:"afk_timeout"` // afk timeout in seconds
34+
WidgetEnabled bool `json:"widget_enabled,omitempty"` // true if the server widget is enabled
35+
WidgetChannelID *Snowflake `json:"widget_channel_id,omitempty"` // the channel id that the widget will generate an "invite" to, or null if set to no invite
36+
VerificationLevel VerificationLevel `json:"verification_level"` // verification level required for the guild
37+
DefaultMessageNotifications DefaultMessageNotificationLevel `json:"default_message_notifications"` // default message notifications level
38+
ExplicitContentFilter ExplicitContentFilterLevel `json:"explicit_content_filter"` // explicit content filter level
39+
Roles []*Role `json:"roles"` // roles in the guild
40+
Emojis []*Emoji `json:"emojis"` // custom guild emojis
41+
Features []*GuildFeatures `json:"features"` // enabled guild features
42+
MfaLevel MfaLevel `json:"mfa_level"` // required MFA level for the guild
43+
ApplicationID *Snowflake `json:"application_id"` // application id of the guild creator if it is bot-created
44+
SystemChannelID *Snowflake `json:"system_channel_id"` // the id of the channel where guild notices such as welcome messages and boost events are posted
45+
SystemChannelFlags SystemChannelFlags `json:"system_channel_flags"` // system channel flags
46+
RulesChannelID *Snowflake `json:"rules_channel_id"` // the id of the channel where Community guilds can display rules and/or guidelines
47+
MaxPresences *int64 `json:"max_presences,omitempty"` // the maximum number of presences for the guild (null is always returned, apart from the largest of guilds)
48+
MaxMembers int64 `json:"max_members,omitempty"` // the maximum number of members for the guild
49+
VanityUrlCode *string `json:"vanity_url_code"` // the vanity url code for the guild
50+
Description *string `json:"description"` // the description of a Community guild
51+
Banner *string `json:"banner"` // banner hash
52+
PremiumTier PremiumTier `json:"premium_tier"` // premium tier (Server Boost level)
53+
PremiumSubscriptionCount uint64 `json:"premium_subscription_count,omitempty"` // the number of boosts this guild currently has
54+
PreferredLocale string `json:"preferred_locale"` // the preferred locale of a Community guild; used in server discovery and notices from Discord, and sent in interactions; defaults to "en-US"
55+
PublicUpdatesChannelID *Snowflake `json:"public_updates_channel_id"` // the id of the channel where admins and moderators of Community guilds receive notices from Discord
56+
MaxVideoChannelUsers uint64 `json:"max_video_channel_users,omitempty"` // the maximum amount of users in a video channel
57+
MaxStageVideoChannelUsers uint64 `json:"max_stage_video_channel_users,omitempty"` // the maximum amount of users in a stage video channel
58+
ApproximateMemberCount uint64 `json:"approximate_member_count,omitempty"` // approximate number of members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
59+
ApproximatePresenceCount uint64 `json:"approximate_presence_count,omitempty"` // approximate number of non-offline members in this guild, returned from the GET /guilds/<id> endpoint when with_counts is true
60+
WelcomeScreen WelcomeScreen `json:"welcome_screen,omitempty"` // the welcome screen of a Community guild, shown to new members, returned in an Invite's guild object
61+
NsfwLevel GuildNsfwLevel `json:"nsfw_level"` // guild NSFW level
62+
Stickers []*Sticker `json:"stickers,omitempty"` // custom guild stickers
63+
PremiumProgressBarEnabled bool `json:"premium_progress_bar_enabled"` // whether the guild has the boost progress bar enabled
6364

6465
// These fields are only sent when using the GET CurrentUserGuilds endpoint and are relative to the requested user
6566

@@ -316,6 +317,44 @@ type WelcomeScreenChannel struct {
316317
EmojiName *string `json:"emoji_name,omitempty"` // the emoji name if custom, the unicode character if standard, or null if no emoji is set
317318
}
318319

320+
// GuildOnboarding - Represents the onboarding flow for a guild.
321+
type GuildOnboarding struct {
322+
GuildID Snowflake `json:"guild_id"` // ID of the guild this onboarding is part of
323+
Prompts []OnboardingPrompt `json:"prompts"` // Prompts shown during onboarding and in customize community
324+
DefaultChanelIds []Snowflake `json:"default_chanel_ids"` // Channel IDs that members get opted into automatically
325+
Enabled bool `json:"enabled"` // Whether onboarding is enabled in the guild
326+
}
327+
328+
// OnboardingPrompt - Prompts shown during onboarding and in customize community
329+
type OnboardingPrompt struct {
330+
ID Snowflake `json:"id"` // ID of the prompt
331+
Type PromptType `json:"type"` // Type of prompt
332+
Options []PromptOption `json:"options"` // Options available within the prompt
333+
Title string `json:"title"` // Title of the prompt
334+
SingleSelect bool `json:"single_select"` // Indicates whether users are limited to selecting one option for the prompt
335+
Required bool `json:"required"` // Indicates whether the prompt is required before a user completes the onboarding flow
336+
InOnboarding bool `json:"in_onboarding"` // Indicates whether the prompt is present in the onboarding flow. If false, the prompt will only appear in the Channels & Roles tab
337+
}
338+
339+
// PromptOption - Options available within the prompt
340+
type PromptOption struct {
341+
ID Snowflake `json:"id"` // ID of the prompt option
342+
ChannelIds []Snowflake `json:"channel_ids"` // IDs for channels a member is added to when the option is selected
343+
RoleIds []Snowflake `json:"role_ids"` // IDs for roles assigned to a member when the option is selected
344+
Emoji Emoji `json:"emoji"` // Emoji of the option
345+
Title string `json:"title"` // Title of the option
346+
Description *string `json:"description"` // Description of the option
347+
}
348+
349+
// PromptType - Type of prompt
350+
type PromptType int
351+
352+
//goland:noinspection GoUnusedConst
353+
const (
354+
MultipleChoice PremiumType = iota
355+
Dropdown
356+
)
357+
319358
// String - Helper function to convert basic Guild data into string form
320359
func (g *Guild) String() string {
321360
return g.Name + "(" + g.ID.String() + ")"

api/guild_endpoints.go

+15
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,21 @@ type ModifyGuildWelcomeScreenJSON struct {
10241024
Description *string `json:"description,omitempty"` // the server description to show in the welcome screen
10251025
}
10261026

1027+
func (g *Guild) GetGuildOnboarding() (*GuildOnboarding, error) {
1028+
u := parseRoute(fmt.Sprintf(getGuildOnboarding, api, g.ID.String()))
1029+
1030+
var onboarding *GuildOnboarding
1031+
responseBytes, err := fireGetRequest(u, nil, nil)
1032+
if err != nil {
1033+
log.Errorln(log.Discord, log.FuncName(), err)
1034+
return nil, err
1035+
}
1036+
1037+
err = json.Unmarshal(responseBytes, &onboarding)
1038+
1039+
return onboarding, err
1040+
}
1041+
10271042
// ModifyCurrentUserVoiceState - Updates the current user's voice state. Returns 204 No Content on success.
10281043
//
10291044
// There are currently several caveats for this endpoint:

api/interactions.go

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Interaction struct {
3838
Type InteractionType `json:"type"` // Type of interaction
3939
Data ApplicationCommandData `json:"data,omitempty"` // Interaction data payload
4040
GuildID Snowflake `json:"guild_id,omitempty"` // Guild that the interaction was sent from
41+
Channel Channel `json:"channel,omitempty"` // Channel that the interaction was sent from
4142
ChannelID Snowflake `json:"channel_id,omitempty"` // Channel that the interaction was sent from
4243
Member GuildMember `json:"member,omitempty"` // GuildMember data for the invoking user, including permissions
4344
User *User `json:"user,omitempty"` // User object for the invoking user, if invoked in a DM

0 commit comments

Comments
 (0)