1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-09-28 21:29:25 +00:00

discord: Rename IntentGuildBans; add GuildAuditLogEntryCreateEvent (#370)

* Rename GuildBans intent & add GUILD_AUDIT_LOG_ENTRY_CREATE event

* Add IntentGuildBans constant for backward compatibility
This commit is contained in:
ayn2op 2023-01-27 15:04:50 +05:30 committed by GitHub
parent 05dbf0e2b4
commit 55d19000a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View file

@ -31,6 +31,7 @@ func init() {
func() ws.Event { return new(GuildCreateEvent) },
func() ws.Event { return new(GuildUpdateEvent) },
func() ws.Event { return new(GuildDeleteEvent) },
func() ws.Event { return new(GuildAuditLogEntryCreateEvent) },
func() ws.Event { return new(GuildBanAddEvent) },
func() ws.Event { return new(GuildBanRemoveEvent) },
func() ws.Event { return new(GuildEmojisUpdateEvent) },
@ -228,6 +229,12 @@ func (*GuildDeleteEvent) Op() ws.OpCode { return dispatchOp }
// EventType implements Event.
func (*GuildDeleteEvent) EventType() ws.EventType { return "GUILD_DELETE" }
// Op implements Event. It always returns 0.
func (*GuildAuditLogEntryCreateEvent) Op() ws.OpCode { return dispatchOp }
// EventType implements Event.
func (*GuildAuditLogEntryCreateEvent) EventType() ws.EventType { return "GUILD_AUDIT_LOG_ENTRY_CREATE" }
// Op implements Event. It always returns 0.
func (*GuildBanAddEvent) Op() ws.OpCode { return dispatchOp }

View file

@ -294,6 +294,13 @@ type GuildDeleteEvent struct {
Unavailable bool `json:"unavailable"`
}
// GuildAuditLogEntryCreateEvent is a dispatch event.
// https://discord.com/developers/docs/topics/gateway#guilds
type GuildAuditLogEntryCreateEvent struct {
discord.AuditLogEntry
}
// GuildBanAddEvent is a dispatch event.
//
// https://discord.com/developers/docs/topics/gateway#guilds

View file

@ -12,7 +12,7 @@ type Intents uint32
const (
IntentGuilds Intents = 1 << iota
IntentGuildMembers
IntentGuildBans
IntentGuildModeration
IntentGuildEmojis
IntentGuildIntegrations
IntentGuildWebhooks
@ -29,6 +29,11 @@ const (
IntentGuildScheduledEvents
)
// IntentGuildBans is an alias to IntentGuildModeration.
//
// Deprecated: IntentGuildModeration is the more correct constant to use.
const IntentGuildBans = IntentGuildModeration
// PrivilegedIntents contains a list of privileged intents that Discord requires
// bots to have these intents explicitly enabled in the Developer Portal.
var PrivilegedIntents = []Intents{
@ -65,8 +70,9 @@ var EventIntents = map[ws.EventType]Intents{
"GUILD_MEMBER_REMOVE": IntentGuildMembers,
"GUILD_MEMBER_UPDATE": IntentGuildMembers,
"GUILD_BAN_ADD": IntentGuildBans,
"GUILD_BAN_REMOVE": IntentGuildBans,
"GUILD_AUDIT_LOG_ENTRY_CREATE": IntentGuildModeration,
"GUILD_BAN_ADD": IntentGuildModeration,
"GUILD_BAN_REMOVE": IntentGuildModeration,
"GUILD_EMOJIS_UPDATE": IntentGuildEmojis,