mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
chore: require redis connection for bot
This commit is contained in:
parent
52c9ca9d0e
commit
3e76fd8d28
4 changed files with 5 additions and 14 deletions
|
|
@ -53,8 +53,7 @@ public class Init
|
|||
|
||||
// initialize Redis
|
||||
var redis = services.Resolve<RedisService>();
|
||||
if (coreConfig.RedisAddr != null)
|
||||
await redis.InitAsync(coreConfig);
|
||||
await redis.InitAsync(coreConfig);
|
||||
|
||||
var cache = services.Resolve<IDiscordCache>();
|
||||
if (cache is RedisDiscordCache)
|
||||
|
|
@ -67,16 +66,14 @@ public class Init
|
|||
await services.Resolve<IDatabase>().ApplyMigrations();
|
||||
|
||||
// Clear shard status from Redis
|
||||
if (redis.Connection != null)
|
||||
await redis.Connection.GetDatabase().KeyDeleteAsync("pluralkit:shardstatus");
|
||||
await redis.Connection.GetDatabase().KeyDeleteAsync("pluralkit:shardstatus");
|
||||
}
|
||||
|
||||
logger.Information("Initializing bot");
|
||||
var bot = services.Resolve<Bot>();
|
||||
|
||||
// Get bot status message from Redis
|
||||
if (redis.Connection != null)
|
||||
bot.CustomStatusMessage = await redis.Connection.GetDatabase().StringGetAsync("pluralkit:botstatus");
|
||||
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();
|
||||
|
|
|
|||
|
|
@ -52,12 +52,6 @@ public class ShardInfoService
|
|||
|
||||
async Task Inner()
|
||||
{
|
||||
if (_redis.Connection == null)
|
||||
{
|
||||
_logger.Warning("Redis is disabled, shard connection status will be unavailable.");
|
||||
return;
|
||||
}
|
||||
|
||||
var db = _redis.Connection.GetDatabase();
|
||||
var redisInfo = await db.HashGetAsync("pluralkit::shardstatus", shard.ShardId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue