mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-21 03:57:26 +00:00
Gateway: Added an Event to Intents map for convenience
This commit is contained in:
parent
c00d31ce30
commit
b8e4b2cf56
|
@ -55,28 +55,6 @@ func (i *IdentifyData) SetShard(id, num int) {
|
||||||
i.Shard[0], i.Shard[1] = id, num
|
i.Shard[0], i.Shard[1] = id, num
|
||||||
}
|
}
|
||||||
|
|
||||||
// Intents for the new Discord API feature, documented at
|
|
||||||
// https://discordapp.com/developers/docs/topics/gateway#gateway-intents.
|
|
||||||
type Intents uint32
|
|
||||||
|
|
||||||
const (
|
|
||||||
IntentGuilds Intents = 1 << iota
|
|
||||||
IntentGuildMembers
|
|
||||||
IntentGuildBans
|
|
||||||
IntentGuildEmojis
|
|
||||||
IntentGuildIntegrations
|
|
||||||
IntentGuildWebhooks
|
|
||||||
IntentGuildInvites
|
|
||||||
IntentGuildVoiceStates
|
|
||||||
IntentGuildPresences
|
|
||||||
IntentGuildMessages
|
|
||||||
IntentGuildMessageReactions
|
|
||||||
IntentGuildMessageTyping
|
|
||||||
IntentDirectMessages
|
|
||||||
IntentDirectMessageReactions
|
|
||||||
IntentDirectMessageTyping
|
|
||||||
)
|
|
||||||
|
|
||||||
type Identifier struct {
|
type Identifier struct {
|
||||||
IdentifyData
|
IdentifyData
|
||||||
|
|
||||||
|
|
30
gateway/intents.go
Normal file
30
gateway/intents.go
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package gateway
|
||||||
|
|
||||||
|
// Intents for the new Discord API feature, documented at
|
||||||
|
// https://discordapp.com/developers/docs/topics/gateway#gateway-intents.
|
||||||
|
type Intents uint32
|
||||||
|
|
||||||
|
const (
|
||||||
|
IntentGuilds Intents = 1 << iota
|
||||||
|
IntentGuildMembers
|
||||||
|
IntentGuildBans
|
||||||
|
IntentGuildEmojis
|
||||||
|
IntentGuildIntegrations
|
||||||
|
IntentGuildWebhooks
|
||||||
|
IntentGuildInvites
|
||||||
|
IntentGuildVoiceStates
|
||||||
|
IntentGuildPresences
|
||||||
|
IntentGuildMessages
|
||||||
|
IntentGuildMessageReactions
|
||||||
|
IntentGuildMessageTyping
|
||||||
|
IntentDirectMessages
|
||||||
|
IntentDirectMessageReactions
|
||||||
|
IntentDirectMessageTyping
|
||||||
|
)
|
||||||
|
|
||||||
|
// PrivilegedIntents contains a list of privileged intents that Discord requires
|
||||||
|
// bots to have these intents explicitly enabled in the Developer Portal.
|
||||||
|
var PrivilegedIntents = []Intents{
|
||||||
|
IntentGuildPresences,
|
||||||
|
IntentGuildMembers,
|
||||||
|
}
|
47
gateway/intents_map.go
Normal file
47
gateway/intents_map.go
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
package gateway
|
||||||
|
|
||||||
|
// EventIntents maps event types to intents.
|
||||||
|
var EventIntents = map[string]Intents{
|
||||||
|
"GUILD_CREATE": IntentGuilds,
|
||||||
|
"GUILD_UPDATE": IntentGuilds,
|
||||||
|
"GUILD_DELETE": IntentGuilds,
|
||||||
|
"GUILD_ROLE_CREATE": IntentGuilds,
|
||||||
|
"GUILD_ROLE_UPDATE": IntentGuilds,
|
||||||
|
"GUILD_ROLE_DELETE": IntentGuilds,
|
||||||
|
"CHANNEL_CREATE": IntentGuilds,
|
||||||
|
"CHANNEL_UPDATE": IntentGuilds,
|
||||||
|
"CHANNEL_DELETE": IntentGuilds,
|
||||||
|
"CHANNEL_PINS_UPDATE": IntentGuilds | IntentDirectMessages,
|
||||||
|
|
||||||
|
"GUILD_MEMBER_ADD": IntentGuildMembers,
|
||||||
|
"GUILD_MEMBER_REMOVE": IntentGuildMembers,
|
||||||
|
"GUILD_MEMBER_UPDATE": IntentGuildMembers,
|
||||||
|
|
||||||
|
"GUILD_BAN_ADD": IntentGuildBans,
|
||||||
|
"GUILD_BAN_REMOVE": IntentGuildBans,
|
||||||
|
|
||||||
|
"GUILD_EMOJIS_UPDATE": IntentGuildEmojis,
|
||||||
|
|
||||||
|
"GUILD_INTEGRATIONS_UPDATE": IntentGuildIntegrations,
|
||||||
|
|
||||||
|
"WEBHOOKS_UPDATE": IntentGuildWebhooks,
|
||||||
|
|
||||||
|
"INVITE_CREATE": IntentGuildInvites,
|
||||||
|
"INVITE_DELETE": IntentGuildInvites,
|
||||||
|
|
||||||
|
"VOICE_STATE_UPDATE": IntentGuildVoiceStates,
|
||||||
|
|
||||||
|
"PRESENCE_UPDATE": IntentGuildPresences,
|
||||||
|
|
||||||
|
"MESSAGE_CREATE": IntentGuildMessages | IntentDirectMessages,
|
||||||
|
"MESSAGE_UPDATE": IntentGuildMessages | IntentDirectMessages,
|
||||||
|
"MESSAGE_DELETE": IntentGuildMessages | IntentDirectMessages,
|
||||||
|
"MESSAGE_DELETE_BULK": IntentGuildMessages,
|
||||||
|
|
||||||
|
"MESSAGE_REACTION_ADD": IntentGuildMessageReactions | IntentDirectMessageReactions,
|
||||||
|
"MESSAGE_REACTION_REMOVE": IntentGuildMessageReactions | IntentDirectMessageReactions,
|
||||||
|
"MESSAGE_REACTION_REMOVE_ALL": IntentGuildMessageReactions | IntentDirectMessageReactions,
|
||||||
|
"MESSAGE_REACTION_REMOVE_EMOJI": IntentGuildMessageReactions | IntentDirectMessageReactions,
|
||||||
|
|
||||||
|
"TYPING_START": IntentGuildMessageTyping | IntentDirectMessageTyping,
|
||||||
|
}
|
Loading…
Reference in a new issue