mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Made it possible to disable Rainbet, Chips.gg and Howl.gg as they're not really working right now and just spamming errors
This commit is contained in:
@@ -121,8 +121,13 @@ public class BotServices
|
|||||||
|
|
||||||
private async Task BuildChipsgg()
|
private async Task BuildChipsgg()
|
||||||
{
|
{
|
||||||
var proxy = await Helpers.GetValue(BuiltIn.Keys.Proxy);
|
var settings = await Helpers.GetMultipleValues([BuiltIn.Keys.Proxy, BuiltIn.Keys.ChipsggEnabled]);
|
||||||
_chipsgg = new Chipsgg(proxy.Value, _cancellationToken);
|
if (!settings[BuiltIn.Keys.ChipsggEnabled].ToBoolean())
|
||||||
|
{
|
||||||
|
_logger.Debug("Chips.gg is disabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_chipsgg = new Chipsgg(settings[BuiltIn.Keys.Proxy].Value, _cancellationToken);
|
||||||
_chipsgg.OnChipsggRecentBet += OnChipsggRecentBet;
|
_chipsgg.OnChipsggRecentBet += OnChipsggRecentBet;
|
||||||
await _chipsgg.StartWsClient();
|
await _chipsgg.StartWsClient();
|
||||||
_logger.Info("Built Chips.gg Websocket connection");
|
_logger.Info("Built Chips.gg Websocket connection");
|
||||||
@@ -155,8 +160,13 @@ public class BotServices
|
|||||||
|
|
||||||
private async Task BuildHowlgg()
|
private async Task BuildHowlgg()
|
||||||
{
|
{
|
||||||
var proxy = await Helpers.GetValue(BuiltIn.Keys.Proxy);
|
var settings = await Helpers.GetMultipleValues([BuiltIn.Keys.Proxy, BuiltIn.Keys.HowlggEnabled]);
|
||||||
_howlgg = new Howlgg(proxy.Value, _cancellationToken);
|
if (!settings[BuiltIn.Keys.HowlggEnabled].ToBoolean())
|
||||||
|
{
|
||||||
|
_logger.Debug("Howlgg is disabled");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_howlgg = new Howlgg(settings[BuiltIn.Keys.Proxy].Value, _cancellationToken);
|
||||||
_howlgg.OnHowlggBetHistory += OnHowlggBetHistory;
|
_howlgg.OnHowlggBetHistory += OnHowlggBetHistory;
|
||||||
await _howlgg.StartWsClient();
|
await _howlgg.StartWsClient();
|
||||||
_logger.Info("Built Howl.gg Websocket connection");
|
_logger.Info("Built Howl.gg Websocket connection");
|
||||||
@@ -217,7 +227,7 @@ public class BotServices
|
|||||||
while (await timer.WaitForNextTickAsync(_cancellationToken))
|
while (await timer.WaitForNextTickAsync(_cancellationToken))
|
||||||
{
|
{
|
||||||
if (_chatBot.InitialStartCooldown) continue;
|
if (_chatBot.InitialStartCooldown) continue;
|
||||||
var settings = await Helpers.GetMultipleValues([BuiltIn.Keys.KickEnabled]);
|
var settings = await Helpers.GetMultipleValues([BuiltIn.Keys.KickEnabled, BuiltIn.Keys.HowlggEnabled, BuiltIn.Keys.ChipsggEnabled]);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_shuffle.IsConnected())
|
if (!_shuffle.IsConnected())
|
||||||
@@ -252,7 +262,7 @@ public class BotServices
|
|||||||
await BuildTwitchChat();
|
await BuildTwitchChat();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_howlgg.IsConnected())
|
if (settings[BuiltIn.Keys.HowlggEnabled].ToBoolean() && !_howlgg.IsConnected())
|
||||||
{
|
{
|
||||||
_logger.Error("Howl.gg died, recreating it");
|
_logger.Error("Howl.gg died, recreating it");
|
||||||
_howlgg.Dispose();
|
_howlgg.Dispose();
|
||||||
@@ -268,7 +278,7 @@ public class BotServices
|
|||||||
await BuildJackpot();
|
await BuildJackpot();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_chipsgg.IsConnected())
|
if (settings[BuiltIn.Keys.ChipsggEnabled].ToBoolean() && !_chipsgg.IsConnected())
|
||||||
{
|
{
|
||||||
_logger.Error("Chips died, recreating it");
|
_logger.Error("Chips died, recreating it");
|
||||||
_chipsgg.Dispose();
|
_chipsgg.Dispose();
|
||||||
|
|||||||
@@ -36,6 +36,12 @@ public class Rainbet : IDisposable
|
|||||||
using var timer = new PeriodicTimer(_gameHistoryInterval);
|
using var timer = new PeriodicTimer(_gameHistoryInterval);
|
||||||
while (await timer.WaitForNextTickAsync(_gameHistoryCts.Token))
|
while (await timer.WaitForNextTickAsync(_gameHistoryCts.Token))
|
||||||
{
|
{
|
||||||
|
var enabled = await Helpers.GetValue(BuiltIn.Keys.RainbetEnabled);
|
||||||
|
if (!enabled.ToBoolean())
|
||||||
|
{
|
||||||
|
_logger.Debug("Rainbet is disabled");
|
||||||
|
continue;
|
||||||
|
};
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_logger.Info($"Retrieving game history from Rainbet, last success: {LastSuccessfulRefresh:yyyy-MM-dd HH:mm:ss}");
|
_logger.Info($"Retrieving game history from Rainbet, last success: {LastSuccessfulRefresh:yyyy-MM-dd HH:mm:ss}");
|
||||||
|
|||||||
@@ -625,6 +625,33 @@ public static class BuiltIn
|
|||||||
Default = "[]",
|
Default = "[]",
|
||||||
IsSecret = false,
|
IsSecret = false,
|
||||||
CacheDuration = TimeSpan.Zero
|
CacheDuration = TimeSpan.Zero
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.HowlggEnabled,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Whether the Howl.gg integration is enabled at all",
|
||||||
|
Default = "false",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1)
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.ChipsggEnabled,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Whether the Chips.gg integration is enabled at all",
|
||||||
|
Default = "false",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1)
|
||||||
|
},
|
||||||
|
new BuiltInSettingsModel
|
||||||
|
{
|
||||||
|
Key = Keys.RainbetEnabled,
|
||||||
|
Regex = "(true|false)",
|
||||||
|
Description = "Whether the Rainbet integration is enabled at all",
|
||||||
|
Default = "false",
|
||||||
|
IsSecret = false,
|
||||||
|
CacheDuration = TimeSpan.FromHours(1)
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -686,5 +713,8 @@ public static class BuiltIn
|
|||||||
public static string BotNextCourtHearing = "Bot.Court.NextHearing";
|
public static string BotNextCourtHearing = "Bot.Court.NextHearing";
|
||||||
public static string BotJailStartTime = "Bot.Jail.StartTime";
|
public static string BotJailStartTime = "Bot.Jail.StartTime";
|
||||||
public static string BotCourtCalendar = "Bot.Court.Calendar";
|
public static string BotCourtCalendar = "Bot.Court.Calendar";
|
||||||
|
public static string HowlggEnabled = "Howlgg.Enabled";
|
||||||
|
public static string ChipsggEnabled = "Chipsgg.Enabled";
|
||||||
|
public static string RainbetEnabled = "Rainbet.Enabled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user