feat: dispatch new bot status to clusters via Redis

This commit is contained in:
spiral
2022-03-30 20:42:57 -04:00
parent 973d6d883c
commit 6a213fa694
2 changed files with 37 additions and 4 deletions

View File

@@ -61,11 +61,15 @@ public class Init
await redis.Connection.GetDatabase().KeyDeleteAsync("pluralkit:shardstatus");
}
// Init the bot instance itself, register handlers and such to the client before beginning to connect
logger.Information("Initializing bot");
var bot = services.Resolve<Bot>();
bot.Init();
// Get bot status message from Redis
if (redis.Connection != null)
bot.CustomStatusMessage = await redis.Connection.GetDatabase().StringGetAsync("pluralkit:botstatus");
// Init the bot instance itself, register handlers and such to the client before beginning to connect
bot.Init();
// Start the Discord shards themselves (handlers already set up)
logger.Information("Connecting to Discord");