diff options
author | Jordan <me@jordan.im> | 2022-03-17 09:43:29 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2022-03-17 09:43:29 -0700 |
commit | 66bfe530b4fd5cb9755337ce718df26ee81f1b77 (patch) | |
tree | 9dfc8a79183b8bffc12db5a92f957e3bfd37d4f2 /vendor/github.com/bwmarrin/discordgo/wsapi.go | |
parent | 2f0b35e3c25bc4394f3288e1baa77d250cb510ed (diff) | |
download | keep-66bfe530b4fd5cb9755337ce718df26ee81f1b77.tar.gz keep-66bfe530b4fd5cb9755337ce718df26ee81f1b77.zip |
misc: go get -u ./... ; go mod vendor
Diffstat (limited to 'vendor/github.com/bwmarrin/discordgo/wsapi.go')
-rw-r--r-- | vendor/github.com/bwmarrin/discordgo/wsapi.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/vendor/github.com/bwmarrin/discordgo/wsapi.go b/vendor/github.com/bwmarrin/discordgo/wsapi.go index 29a4f61..f2c228d 100644 --- a/vendor/github.com/bwmarrin/discordgo/wsapi.go +++ b/vendor/github.com/bwmarrin/discordgo/wsapi.go @@ -33,7 +33,7 @@ var ErrWSAlreadyOpen = errors.New("web socket already opened") var ErrWSNotFound = errors.New("no websocket connection exists") // ErrWSShardBounds is thrown when you try to use a shard ID that is -// less than the total shard count +// more than the total shard count var ErrWSShardBounds = errors.New("ShardID must be less than ShardCount") type resumePacket struct { @@ -383,6 +383,17 @@ func (s *Session) UpdateListeningStatus(name string) (err error) { // UpdateStatusComplex allows for sending the raw status update data untouched by discordgo. func (s *Session) UpdateStatusComplex(usd UpdateStatusData) (err error) { + // The comment does say "untouched by discordgo", but we might need to lie a bit here. + // The Discord documentation lists `activities` as being nullable, but in practice this + // doesn't seem to be the case. I had filed an issue about this at + // https://github.com/discord/discord-api-docs/issues/2559, but as of writing this + // haven't had any movement on it, so at this point I'm assuming this is an error, + // and am fixing this bug accordingly. Because sending `null` for `activities` instantly + // disconnects us, I think that disallowing it from being sent in `UpdateStatusComplex` + // isn't that big of an issue. + if usd.Activities == nil { + usd.Activities = make([]*Activity, 0) + } s.RLock() defer s.RUnlock() @@ -755,13 +766,13 @@ func (s *Session) identify() error { s.log(LogDebug, "called") // TODO: This is a temporary block of code to help - // maintain backwards compatability + // maintain backwards compatibility if s.Compress == false { s.Identify.Compress = false } // TODO: This is a temporary block of code to help - // maintain backwards compatability + // maintain backwards compatibility if s.Token != "" && s.Identify.Token == "" { s.Identify.Token = s.Token } |