diff --git a/discord/guild_onboarding.go b/discord/guild_onboarding.go index 4b397673..a3dbd17d 100644 --- a/discord/guild_onboarding.go +++ b/discord/guild_onboarding.go @@ -1,6 +1,9 @@ package discord -import "github.com/disgoorg/snowflake/v2" +import ( + "github.com/disgoorg/json" + "github.com/disgoorg/snowflake/v2" +) type GuildOnboarding struct { GuildID snowflake.ID `json:"guild_id"` @@ -21,12 +24,28 @@ type GuildOnboardingPrompt struct { } type GuildOnboardingPromptOption struct { - ID snowflake.ID `json:"id"` - ChannelIDs []snowflake.ID `json:"channel_ids"` - RoleIDs []snowflake.ID `json:"role_ids"` - Emoji PartialEmoji `json:"emoji"` - Title string `json:"title"` - Description *string `json:"description"` + ID snowflake.ID `json:"id"` + ChannelIDs []snowflake.ID `json:"channel_ids"` + RoleIDs []snowflake.ID `json:"role_ids"` + // When creating or updating prompts and their options, this field will be broken down into 3 separate fields in the payload: https://github.com/discord/discord-api-docs/pull/6479 + Emoji PartialEmoji `json:"emoji"` + Title string `json:"title"` + Description *string `json:"description"` +} + +func (o GuildOnboardingPromptOption) MarshalJSON() ([]byte, error) { + type onboardingPromptOption GuildOnboardingPromptOption + return json.Marshal(struct { + EmojiID *snowflake.ID `json:"emoji_id,omitempty"` + EmojiName *string `json:"emoji_name,omitempty"` + EmojiAnimated bool `json:"emoji_animated"` + onboardingPromptOption + }{ + EmojiID: o.Emoji.ID, + EmojiName: o.Emoji.Name, + EmojiAnimated: o.Emoji.Animated, + onboardingPromptOption: onboardingPromptOption(o), + }) } type GuildOnboardingPromptType int