From 1e1170099e823335a428d29284cbdaee77bf2053 Mon Sep 17 00:00:00 2001 From: Marius Begby Date: Mon, 28 Aug 2023 16:21:44 +0200 Subject: [PATCH] fix: listen for more shard events --- src/index.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/index.ts b/src/index.ts index 8cba544..a28141f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -37,6 +37,22 @@ manager.on('shardCreate', (shard: Shard) => { logger.info('All shards ready, bot is now online.'); } }); + + shard.on(ShardEvents.Death, (event) => { + logger.fatal(event, 'SHARD CLOSED UNEXPECTEDLY.'); + }); + + shard.on(ShardEvents.Error, (error) => { + logger.error(error, 'Shard experienced an error, most likely related to websocket connection error.'); + }); + + shard.on(ShardEvents.Disconnect, () => { + logger.warn('Shard disconnected.'); + }); + + shard.on(ShardEvents.Reconnecting, () => { + logger.warn('Shard reconnecting.'); + }); }); manager.spawn();