Skip to content

Commit

Permalink
fix(discord): do not re-identify with bot._sessionId, fix #297
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jul 8, 2021
1 parent 16a22f0 commit 845afc0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/adapter-discord/src/ws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ export default class WsClient extends Adapter.WsClient<'discord'> {
if (parsed.s) {
bot._d = parsed.s
}

// https://discord.com/developers/docs/topics/gateway#identifying
if (parsed.op === Opcode.Hello) {
bot._ping = setInterval(() => this.heartbeat(bot), parsed.d.heartbeat_interval)
if (bot._sessionId) return
bot.socket.send(JSON.stringify({
op: Opcode.Identify,
d: {
Expand Down

0 comments on commit 845afc0

Please sign in to comment.