diff --git a/discord/channel.go b/discord/channel.go index d1bf4dc2..a2312d0f 100644 --- a/discord/channel.go +++ b/discord/channel.go @@ -34,8 +34,9 @@ const ( type ChannelFlags int const ( - ChannelFlagPinned ChannelFlags = 1 << (iota + 1) - ChannelFlagsNone ChannelFlags = 0 + ChannelFlagPinned ChannelFlags = 1 << 1 + ChannelFlagRequireTag ChannelFlags = 1 << 4 + ChannelFlagsNone ChannelFlags = 0 ) // Add allows you to add multiple bits together, producing a new bit @@ -810,6 +811,7 @@ type GuildThread struct { parentID snowflake.ID MessageCount int TotalMessageSent int + AppliedTags []snowflake.ID MemberCount int ThreadMetadata ThreadMetadata } @@ -832,6 +834,7 @@ func (c *GuildThread) UnmarshalJSON(data []byte) error { c.parentID = v.ParentID c.MessageCount = v.MessageCount c.TotalMessageSent = v.TotalMessageSent + c.AppliedTags = v.AppliedTags c.MemberCount = v.MemberCount c.ThreadMetadata = v.ThreadMetadata return nil @@ -851,6 +854,7 @@ func (c GuildThread) MarshalJSON() ([]byte, error) { ParentID: c.parentID, MessageCount: c.MessageCount, TotalMessageSent: c.TotalMessageSent, + AppliedTags: c.AppliedTags, MemberCount: c.MemberCount, ThreadMetadata: c.ThreadMetadata, }) @@ -1036,15 +1040,20 @@ var ( ) type GuildForumChannel struct { - id snowflake.ID - guildID snowflake.ID - position int - permissionOverwrites PermissionOverwrites - name string - parentID *snowflake.ID - LastThreadID *snowflake.ID - Topic *string - RateLimitPerUser int + id snowflake.ID + guildID snowflake.ID + position int + permissionOverwrites PermissionOverwrites + name string + parentID *snowflake.ID + LastThreadID *snowflake.ID + Topic *string + NSFW bool + RateLimitPerUser int + Flags ChannelFlags + AvailableTags []ForumTag + DefaultReactionEmoji *DefaultReactionEmoji + DefaultThreadRateLimitPerUser int } func (c *GuildForumChannel) UnmarshalJSON(data []byte) error { @@ -1061,22 +1070,32 @@ func (c *GuildForumChannel) UnmarshalJSON(data []byte) error { c.parentID = v.ParentID c.LastThreadID = v.LastThreadID c.Topic = v.Topic + c.NSFW = v.NSFW c.RateLimitPerUser = v.RateLimitPerUser + c.Flags = v.Flags + c.AvailableTags = v.AvailableTags + c.DefaultReactionEmoji = v.DefaultReactionEmoji + c.DefaultThreadRateLimitPerUser = v.DefaultThreadRateLimitPerUser return nil } func (c GuildForumChannel) MarshalJSON() ([]byte, error) { return json.Marshal(guildForumChannel{ - ID: c.id, - Type: c.Type(), - GuildID: c.guildID, - Position: c.position, - PermissionOverwrites: c.permissionOverwrites, - Name: c.name, - ParentID: c.parentID, - LastThreadID: c.LastThreadID, - Topic: c.Topic, - RateLimitPerUser: c.RateLimitPerUser, + ID: c.id, + Type: c.Type(), + GuildID: c.guildID, + Position: c.position, + PermissionOverwrites: c.permissionOverwrites, + Name: c.name, + ParentID: c.parentID, + LastThreadID: c.LastThreadID, + Topic: c.Topic, + NSFW: c.NSFW, + RateLimitPerUser: c.RateLimitPerUser, + Flags: c.Flags, + AvailableTags: c.AvailableTags, + DefaultReactionEmoji: c.DefaultReactionEmoji, + DefaultThreadRateLimitPerUser: c.DefaultThreadRateLimitPerUser, }) } @@ -1149,6 +1168,19 @@ type ThreadMetadata struct { CreateTimestamp time.Time `json:"create_timestamp"` } +type ForumTag struct { + ID snowflake.ID `json:"id"` + Name string `json:"name"` + Moderated bool `json:"moderated"` + EmojiID *snowflake.ID `json:"emoji_id"` + EmojiName *string `json:"emoji_name"` +} + +type DefaultReactionEmoji struct { + EmojiID *snowflake.ID `json:"emoji_id"` + EmojiName *string `json:"emoji_name"` +} + type AutoArchiveDuration int const ( diff --git a/discord/channel_update.go b/discord/channel_update.go index 19ae41d2..65e4c1c6 100644 --- a/discord/channel_update.go +++ b/discord/channel_update.go @@ -15,15 +15,16 @@ type GuildChannelUpdate interface { } type GuildTextChannelUpdate struct { - Name *string `json:"name,omitempty"` - Type *ChannelType `json:"type,omitempty"` - Position *int `json:"position,omitempty"` - Topic *string `json:"topic,omitempty"` - NSFW *bool `json:"nsfw,omitempty"` - RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` - PermissionOverwrites *[]PermissionOverwrite `json:"permission_overwrites,omitempty"` - ParentID *snowflake.ID `json:"parent_id,omitempty"` - DefaultAutoArchiveDuration *AutoArchiveDuration `json:"default_auto_archive_duration,omitempty"` + Name *string `json:"name,omitempty"` + Type *ChannelType `json:"type,omitempty"` + Position *int `json:"position,omitempty"` + Topic *string `json:"topic,omitempty"` + NSFW *bool `json:"nsfw,omitempty"` + RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` + PermissionOverwrites *[]PermissionOverwrite `json:"permission_overwrites,omitempty"` + ParentID *snowflake.ID `json:"parent_id,omitempty"` + DefaultAutoArchiveDuration *AutoArchiveDuration `json:"default_auto_archive_duration,omitempty"` + DefaultThreadRateLimitPerUser *int `json:"default_thread_rate_limit_per_user,omitempty"` } func (GuildTextChannelUpdate) channelUpdate() {} @@ -94,17 +95,35 @@ func (GuildStageVoiceChannelUpdate) channelUpdate() {} func (GuildStageVoiceChannelUpdate) guildChannelUpdate() {} type GuildForumChannelUpdate struct { - Name *string `json:"name,omitempty"` - Position *int `json:"position,omitempty"` - Topic *string `json:"topic,omitempty"` - PermissionOverwrites *[]PermissionOverwrite `json:"permission_overwrites,omitempty"` - ParentID *snowflake.ID `json:"parent_id,omitempty"` - RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` + Name *string `json:"name,omitempty"` + Position *int `json:"position,omitempty"` + Topic *string `json:"topic,omitempty"` + NSFW *bool `json:"nsfw,omitempty"` + PermissionOverwrites *[]PermissionOverwrite `json:"permission_overwrites,omitempty"` + ParentID *snowflake.ID `json:"parent_id,omitempty"` + RateLimitPerUser *int `json:"rate_limit_per_user"` + AvailableTags *[]ForumTag `json:"available_tags,omitempty"` + DefaultReactionEmoji *json.Nullable[DefaultReactionEmoji] `json:"default_reaction_emoji,omitempty"` + DefaultThreadRateLimitPerUser *int `json:"default_thread_rate_limit_per_user,omitempty"` } func (GuildForumChannelUpdate) channelUpdate() {} func (GuildForumChannelUpdate) guildChannelUpdate() {} +type GuildForumThreadChannelUpdate struct { + Name *string `json:"name,omitempty"` + Archived *bool `json:"archived,omitempty"` + AutoArchiveDuration *AutoArchiveDuration `json:"auto_archive_duration,omitempty"` + Locked *bool `json:"locked,omitempty"` + Invitable *bool `json:"invitable,omitempty"` + RateLimitPerUser *int `json:"rate_limit_per_user,omitempty"` + Flags *ChannelFlags `json:"flags,omitempty"` + AppliedTags *[]snowflake.ID `json:"applied_tags,omitempty"` +} + +func (GuildForumThreadChannelUpdate) channelUpdate() {} +func (GuildForumThreadChannelUpdate) guildChannelUpdate() {} + type GuildChannelPositionUpdate struct { ID snowflake.ID `json:"id"` Position *json.Nullable[int] `json:"position"` diff --git a/discord/channels_raw.go b/discord/channels_raw.go index 66fc51b8..0b3f69de 100644 --- a/discord/channels_raw.go +++ b/discord/channels_raw.go @@ -88,6 +88,7 @@ type guildThread struct { LastPinTimestamp *time.Time `json:"last_pin_timestamp"` MessageCount int `json:"message_count"` TotalMessageSent int `json:"total_message_sent"` + AppliedTags []snowflake.ID `json:"applied_tags"` MemberCount int `json:"member_count"` ThreadMetadata ThreadMetadata `json:"thread_metadata"` } @@ -176,15 +177,20 @@ func (t *guildStageVoiceChannel) UnmarshalJSON(data []byte) error { } type guildForumChannel struct { - ID snowflake.ID `json:"id"` - Type ChannelType `json:"type"` - GuildID snowflake.ID `json:"guild_id"` - Position int `json:"position"` - PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` - Name string `json:"name"` - ParentID *snowflake.ID `json:"parent_id"` - Topic *string `json:"topic"` - RateLimitPerUser int `json:"rate_limit_per_user"` + ID snowflake.ID `json:"id"` + Type ChannelType `json:"type"` + GuildID snowflake.ID `json:"guild_id"` + Position int `json:"position"` + PermissionOverwrites []PermissionOverwrite `json:"permission_overwrites"` + Name string `json:"name"` + ParentID *snowflake.ID `json:"parent_id"` + Topic *string `json:"topic"` + NSFW bool `json:"nsfw"` + RateLimitPerUser int `json:"rate_limit_per_user"` + Flags ChannelFlags `json:"flags"` + AvailableTags []ForumTag `json:"available_tags"` + DefaultReactionEmoji *DefaultReactionEmoji `json:"default_reaction_emoji"` + DefaultThreadRateLimitPerUser int `json:"default_thread_rate_limit_per_user"` // idk discord name your shit correctly LastThreadID *snowflake.ID `json:"last_message_id"` diff --git a/discord/thread.go b/discord/thread.go index 153c857e..8f43c1ec 100644 --- a/discord/thread.go +++ b/discord/thread.go @@ -1,6 +1,9 @@ package discord -import "github.com/disgoorg/disgo/json" +import ( + "github.com/disgoorg/disgo/json" + "github.com/disgoorg/snowflake/v2" +) type ThreadCreateFromMessage struct { Name string `json:"name"` @@ -13,6 +16,7 @@ type ForumThreadCreate struct { AutoArchiveDuration AutoArchiveDuration `json:"auto_archive_duration,omitempty"` RateLimitPerUser int `json:"rate_limit_per_user,omitempty"` Message MessageCreate `json:"message"` + AppliedTags []snowflake.ID `json:"applied_tags,omitempty"` } func (c ForumThreadCreate) ToBody() (any, error) {