mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 12:32:03 -04:00
Moved to Lazy<T> and a static class for handling Redis connections with some methods to make it easier to work with JSON. Completely untested.
This commit is contained in:
@@ -23,15 +23,14 @@ public class KasinoKrash : IDisposable
|
||||
{
|
||||
_kfChatBot = kfChatBot;
|
||||
_ct = ct;
|
||||
var connectionString = SettingsProvider.GetValueAsync(BuiltIn.Keys.BotRedisConnectionString).Result;
|
||||
if (string.IsNullOrEmpty(connectionString.Value))
|
||||
if (!Redis.IsAvailable)
|
||||
{
|
||||
_logger.Error($"Can't initialize the Kasino Krash service as Redis isn't configured in {BuiltIn.Keys.BotRedisConnectionString}");
|
||||
_logger.Error($"Can't initialize the Kasino Krash service as Redis isn't configured in {BuiltIn.Keys.BotRedisConnectionString} " +
|
||||
$"or the Redis service failed to connect");
|
||||
return;
|
||||
}
|
||||
|
||||
var redis = ConnectionMultiplexer.Connect(connectionString.Value);
|
||||
_redisDb = redis.GetDatabase();
|
||||
_redisDb = Redis.Multiplexer.GetDatabase();
|
||||
//attempt to pull a game from the db in case the bot crashed while a game was ongoing. if so it will restart the run
|
||||
TheGame = GetKrashState().Result;
|
||||
if (TheGame != null) _ = RunGame();
|
||||
|
||||
Reference in New Issue
Block a user