Make intents optional field

This commit is contained in:
Łukasz Horonziak 2020-05-17 19:52:52 +02:00
parent d12e6550c6
commit 57c962912e
2 changed files with 5 additions and 3 deletions

View file

@ -74,7 +74,6 @@ func New(args ...interface{}) (s *Session, err error) {
s.Identify.GuildSubscriptions = true s.Identify.GuildSubscriptions = true
s.Identify.Properties.OS = runtime.GOOS s.Identify.Properties.OS = runtime.GOOS
s.Identify.Properties.Browser = "DiscordGo v" + VERSION s.Identify.Properties.Browser = "DiscordGo v" + VERSION
s.Identify.Intents = IntentsAllWithoutPrivileged
// If no arguments are passed return the empty Session interface. // If no arguments are passed return the empty Session interface.
if args == nil { if args == nil {

View file

@ -959,7 +959,7 @@ type Identify struct {
Shard *[2]int `json:"shard,omitempty"` Shard *[2]int `json:"shard,omitempty"`
Presence GatewayStatusUpdate `json:"presence,omitempty"` Presence GatewayStatusUpdate `json:"presence,omitempty"`
GuildSubscriptions bool `json:"guild_subscriptions"` GuildSubscriptions bool `json:"guild_subscriptions"`
Intents int `json:"intents"` Intents *Intent `json:"intents,omitempty"`
} }
// IdentifyProperties contains the "properties" portion of an Identify packet // IdentifyProperties contains the "properties" portion of an Identify packet
@ -1104,8 +1104,10 @@ const (
ErrCodeReactionBlocked = 90001 ErrCodeReactionBlocked = 90001
) )
type Intent int
const ( const (
IntentsGuilds = 1 << iota IntentsGuilds Intent = 1 << iota
IntentsGuildMembers IntentsGuildMembers
IntentsGuildBans IntentsGuildBans
IntentsGuildEmojis IntentsGuildEmojis
@ -1137,4 +1139,5 @@ const (
IntentsAll = IntentsAllWithoutPrivileged | IntentsAll = IntentsAllWithoutPrivileged |
IntentsGuildMembers | IntentsGuildMembers |
IntentsGuildPresences IntentsGuildPresences
IntentsNone Intent = 0
) )