diff --git a/src/index.ts b/src/index.ts index 81e0d78d2..9eaf35d17 100644 --- a/src/index.ts +++ b/src/index.ts @@ -623,6 +623,7 @@ async function connect (connectOptions: ConnectOptions) { } else { const originalSetSocket = bot._client.setSocket.bind(bot._client) bot._client.setSocket = (socket) => { + if (!bot) return originalSetSocket(socket) setupConnectHandlers() }