diff --git a/eventhandlers.go b/eventhandlers.go index 9f69a60..fc00717 100644 --- a/eventhandlers.go +++ b/eventhandlers.go @@ -19,6 +19,7 @@ const ( connectEventType = "__CONNECT__" disconnectEventType = "__DISCONNECT__" eventEventType = "__EVENT__" + guildAuditLogEntryCreateEventType = "GUILD_AUDIT_LOG_ENTRY_CREATE" guildBanAddEventType = "GUILD_BAN_ADD" guildBanRemoveEventType = "GUILD_BAN_REMOVE" guildCreateEventType = "GUILD_CREATE" @@ -294,6 +295,26 @@ func (eh eventEventHandler) Handle(s *Session, i interface{}) { } } +// guildAuditLogEntryCreateEventHandler is an event handler for GuildAuditLogEntryCreate events. +type guildAuditLogEntryCreateEventHandler func(*Session, *GuildAuditLogEntryCreate) + +// Type returns the event type for GuildAuditLogEntryCreate events. +func (eh guildAuditLogEntryCreateEventHandler) Type() string { + return guildAuditLogEntryCreateEventType +} + +// New returns a new instance of GuildAuditLogEntryCreate. +func (eh guildAuditLogEntryCreateEventHandler) New() interface{} { + return &GuildAuditLogEntryCreate{} +} + +// Handle is the handler for GuildAuditLogEntryCreate events. +func (eh guildAuditLogEntryCreateEventHandler) Handle(s *Session, i interface{}) { + if t, ok := i.(*GuildAuditLogEntryCreate); ok { + eh(s, t) + } +} + // guildBanAddEventHandler is an event handler for GuildBanAdd events. type guildBanAddEventHandler func(*Session, *GuildBanAdd) @@ -1277,6 +1298,8 @@ func handlerForInterface(handler interface{}) EventHandler { return disconnectEventHandler(v) case func(*Session, *Event): return eventEventHandler(v) + case func(*Session, *GuildAuditLogEntryCreate): + return guildAuditLogEntryCreateEventHandler(v) case func(*Session, *GuildBanAdd): return guildBanAddEventHandler(v) case func(*Session, *GuildBanRemove): @@ -1388,6 +1411,7 @@ func init() { registerInterfaceProvider(channelDeleteEventHandler(nil)) registerInterfaceProvider(channelPinsUpdateEventHandler(nil)) registerInterfaceProvider(channelUpdateEventHandler(nil)) + registerInterfaceProvider(guildAuditLogEntryCreateEventHandler(nil)) registerInterfaceProvider(guildBanAddEventHandler(nil)) registerInterfaceProvider(guildBanRemoveEventHandler(nil)) registerInterfaceProvider(guildCreateEventHandler(nil)) diff --git a/events.go b/events.go index 6608ab6..8438ff8 100644 --- a/events.go +++ b/events.go @@ -401,3 +401,8 @@ type AutoModerationActionExecution struct { MatchedKeyword string `json:"matched_keyword"` MatchedContent string `json:"matched_content"` } + +// GuildAuditLogEntryCreate is the data for a GuildAuditLogEntryCreate event. +type GuildAuditLogEntryCreate struct { + *AuditLogEntry +} diff --git a/structs.go b/structs.go index 2dad321..f23f257 100644 --- a/structs.go +++ b/structs.go @@ -2351,7 +2351,7 @@ type Intent int const ( IntentGuilds Intent = 1 << 0 IntentGuildMembers Intent = 1 << 1 - IntentGuildBans Intent = 1 << 2 + IntentGuildModeration Intent = 1 << 2 IntentGuildEmojis Intent = 1 << 3 IntentGuildIntegrations Intent = 1 << 4 IntentGuildWebhooks Intent = 1 << 5 @@ -2371,6 +2371,8 @@ const ( // TODO: remove when compatibility is not needed + IntentGuildBans Intent = IntentGuildModeration + IntentsGuilds Intent = 1 << 0 IntentsGuildMembers Intent = 1 << 1 IntentsGuildBans Intent = 1 << 2