diff --git a/discord/guild.go b/discord/guild.go index 879a2518..820e5f2b 100644 --- a/discord/guild.go +++ b/discord/guild.go @@ -164,6 +164,7 @@ type Guild struct { PremiumProgressBarEnabled bool `json:"premium_progress_bar_enabled"` JoinedAt time.Time `json:"joined_at"` SafetyAlertsChannelID *snowflake.ID `json:"safety_alerts_channel_id"` + IncidentsData *GuildIncidentsData `json:"incidents_data"` // only over GET /guilds/{guild.id} ApproximateMemberCount int `json:"approximate_member_count"` @@ -299,6 +300,18 @@ type GuildPreview struct { Stickers []Sticker `json:"stickers"` } +type GuildIncidentsData struct { + InvitesDisabledUntil *time.Time `json:"invites_disabled_until"` + DMsDisabledUntil *time.Time `json:"dms_disabled_until"` + DMSpamDetectedAt *time.Time `json:"dm_spam_detected_at"` + RaidDetectedAt *time.Time `json:"raid_detected_at"` +} + +type GuildIncidentActionsUpdate struct { + InvitesDisabledUntil *json.Nullable[time.Time] `json:"invites_disabled_until,omitempty"` + DMsDisabledUntil *json.Nullable[time.Time] `json:"dms_disabled_until,omitempty"` +} + // GuildCreate is the payload used to create a Guild type GuildCreate struct { Name string `json:"name"` diff --git a/discord/message.go b/discord/message.go index 93ef3818..ea46176b 100644 --- a/discord/message.go +++ b/discord/message.go @@ -48,6 +48,13 @@ const ( _ MessageTypeStageTopic MessageTypeGuildApplicationPremiumSubscription + _ + _ + _ + MessageTypeGuildIncidentAlertModeEnabled + MessageTypeGuildIncidentAlertModeDisabled + MessageTypeGuildIncidentReportRaid + MessageTypeGuildIncidentReportFalseAlarm ) func (t MessageType) System() bool { diff --git a/rest/guilds.go b/rest/guilds.go index a382356d..86211bfe 100644 --- a/rest/guilds.go +++ b/rest/guilds.go @@ -58,6 +58,8 @@ type Guilds interface { GetGuildOnboarding(guildID snowflake.ID, opts ...RequestOpt) (*discord.GuildOnboarding, error) UpdateGuildOnboarding(guildID snowflake.ID, onboardingUpdate discord.GuildOnboardingUpdate, opts ...RequestOpt) (*discord.GuildOnboarding, error) + + UpdateGuildIncidentActions(guildID snowflake.ID, actionsUpdate discord.GuildIncidentActionsUpdate, opts ...RequestOpt) (*discord.GuildIncidentsData, error) } type guildImpl struct { @@ -310,3 +312,8 @@ func (s *guildImpl) UpdateGuildOnboarding(guildID snowflake.ID, onboardingUpdate err = s.client.Do(UpdateGuildOnboarding.Compile(nil, guildID), onboardingUpdate, &guildOnboarding, opts...) return } + +func (s *guildImpl) UpdateGuildIncidentActions(guildID snowflake.ID, actionsUpdate discord.GuildIncidentActionsUpdate, opts ...RequestOpt) (incidentsData *discord.GuildIncidentsData, err error) { + err = s.client.Do(UpdateGuildIncidentActions.Compile(nil, guildID), actionsUpdate, &incidentsData, opts...) + return +} diff --git a/rest/rest_endpoints.go b/rest/rest_endpoints.go index 1cb2a12d..375dacb2 100644 --- a/rest/rest_endpoints.go +++ b/rest/rest_endpoints.go @@ -92,6 +92,8 @@ var ( GetGuildOnboarding = NewEndpoint(http.MethodGet, "/guilds/{guild.id}/onboarding") UpdateGuildOnboarding = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/onboarding") + UpdateGuildIncidentActions = NewEndpoint(http.MethodPut, "/guilds/{guild.id}/incident-actions") + UpdateCurrentUserVoiceState = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/@me") UpdateUserVoiceState = NewEndpoint(http.MethodPatch, "/guilds/{guild.id}/voice-states/{user.id}") )