From 167b649902726e8e263ab4318a75340f4f978ac8 Mon Sep 17 00:00:00 2001 From: Carson Hoffman Date: Wed, 20 Jan 2021 18:18:34 -0500 Subject: [PATCH] Remove support for optional intents --- examples/airhorn/main.go | 2 +- examples/pingpong/main.go | 2 +- examples/voice_receive/main.go | 2 +- structs.go | 10 ++++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/airhorn/main.go b/examples/airhorn/main.go index 9a37afa..0955d64 100644 --- a/examples/airhorn/main.go +++ b/examples/airhorn/main.go @@ -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() diff --git a/examples/pingpong/main.go b/examples/pingpong/main.go index e42eb40..1a23140 100644 --- a/examples/pingpong/main.go +++ b/examples/pingpong/main.go @@ -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() diff --git a/examples/voice_receive/main.go b/examples/voice_receive/main.go index e5a9252..c480b9e 100644 --- a/examples/voice_receive/main.go +++ b/examples/voice_receive/main.go @@ -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 { diff --git a/structs.go b/structs.go index fc4fd9a..3975b2e 100644 --- a/structs.go +++ b/structs.go @@ -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 }