Bladeren bron

Remove support for optional intents

Carson Hoffman 3 jaren geleden
bovenliggende
commit
167b649902
4 gewijzigde bestanden met toevoegingen van 9 en 7 verwijderingen
  1. 1 1
      examples/airhorn/main.go
  2. 1 1
      examples/pingpong/main.go
  3. 1 1
      examples/voice_receive/main.go
  4. 6 4
      structs.go

+ 1 - 1
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()

+ 1 - 1
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()

+ 1 - 1
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 {

+ 6 - 4
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
 }