Remove support for optional intents

This commit is contained in:
Carson Hoffman 2021-01-20 18:18:34 -05:00
parent 9fc2793e83
commit 167b649902
No known key found for this signature in database
GPG key ID: 05B660CB452C657F
4 changed files with 9 additions and 7 deletions

View file

@ -55,7 +55,7 @@ func main() {
// We need information about guilds (which includes their channels),
// messages and voice states.
dg.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsGuilds | discordgo.IntentsGuildMessages | discordgo.IntentsGuildVoiceStates)
dg.Identify.Intents = discordgo.IntentsGuilds | discordgo.IntentsGuildMessages | discordgo.IntentsGuildVoiceStates
// Open the websocket and begin listening.
err = dg.Open()

View file

@ -34,7 +34,7 @@ func main() {
dg.AddHandler(messageCreate)
// In this example, we only care about receiving message events.
dg.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsGuildMessages)
dg.Identify.Intents = discordgo.IntentsGuildMessages
// Open a websocket connection to Discord and begin listening.
err = dg.Open()

View file

@ -75,7 +75,7 @@ func main() {
defer s.Close()
// We only really care about receiving voice state updates.
s.Identify.Intents = discordgo.MakeIntent(discordgo.IntentsGuildVoiceStates)
s.Identify.Intents = discordgo.IntentsGuildVoiceStates
err = s.Open()
if err != nil {

View file

@ -1158,7 +1158,7 @@ type Identify struct {
Shard *[2]int `json:"shard,omitempty"`
Presence GatewayStatusUpdate `json:"presence,omitempty"`
GuildSubscriptions bool `json:"guild_subscriptions"`
Intents *Intent `json:"intents,omitempty"`
Intents Intent `json:"intents"`
}
// IdentifyProperties contains the "properties" portion of an Identify packet
@ -1345,7 +1345,9 @@ const (
IntentsNone Intent = 0
)
// MakeIntent helps convert a gateway intent value for use in the Identify structure.
func MakeIntent(intents Intent) *Intent {
return &intents
// MakeIntent used to help convert a gateway intent value for use in the Identify structure;
// this was useful to help support the use of a pointer type when intents were optional.
// This is now a no-op, and is not necessary to use.
func MakeIntent(intents Intent) Intent {
return intents
}