From 57c962912e21b67f877ccb17615de61a4f511db9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Horonziak?= Date: Sun, 17 May 2020 19:52:52 +0200 Subject: [PATCH] Make intents optional field --- discord.go | 1 - structs.go | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/discord.go b/discord.go index 789ca68..74c7887 100644 --- a/discord.go +++ b/discord.go @@ -74,7 +74,6 @@ func New(args ...interface{}) (s *Session, err error) { s.Identify.GuildSubscriptions = true s.Identify.Properties.OS = runtime.GOOS s.Identify.Properties.Browser = "DiscordGo v" + VERSION - s.Identify.Intents = IntentsAllWithoutPrivileged // If no arguments are passed return the empty Session interface. if args == nil { diff --git a/structs.go b/structs.go index 3efc326..b706c18 100644 --- a/structs.go +++ b/structs.go @@ -959,7 +959,7 @@ type Identify struct { Shard *[2]int `json:"shard,omitempty"` Presence GatewayStatusUpdate `json:"presence,omitempty"` GuildSubscriptions bool `json:"guild_subscriptions"` - Intents int `json:"intents"` + Intents *Intent `json:"intents,omitempty"` } // IdentifyProperties contains the "properties" portion of an Identify packet @@ -1104,8 +1104,10 @@ const ( ErrCodeReactionBlocked = 90001 ) +type Intent int + const ( - IntentsGuilds = 1 << iota + IntentsGuilds Intent = 1 << iota IntentsGuildMembers IntentsGuildBans IntentsGuildEmojis @@ -1137,4 +1139,5 @@ const ( IntentsAll = IntentsAllWithoutPrivileged | IntentsGuildMembers | IntentsGuildPresences + IntentsNone Intent = 0 )