mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Humanizer;
|
||||
using Humanizer.Localisation;
|
||||
using KfChatDotNetBot.Commands;
|
||||
using KfChatDotNetBot.Extensions;
|
||||
using KfChatDotNetBot.Models;
|
||||
|
||||
@@ -172,7 +172,13 @@ public class BotServices
|
||||
|
||||
private async Task BuildJackpot()
|
||||
{
|
||||
var proxy = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.Proxy)).Value;
|
||||
var settings = await SettingsProvider.GetMultipleValuesAsync([BuiltIn.Keys.Proxy, BuiltIn.Keys.JackpotEnabled]);
|
||||
if (!settings[BuiltIn.Keys.JackpotEnabled].ToBoolean())
|
||||
{
|
||||
_logger.Debug("Jackpot.bet is disabled");
|
||||
return;
|
||||
}
|
||||
var proxy = settings[BuiltIn.Keys.Proxy].Value;
|
||||
_jackpot = new Jackpot(proxy, _cancellationToken);
|
||||
_jackpot.OnJackpotBet += OnJackpotBet;
|
||||
await _jackpot.StartWsClient();
|
||||
@@ -378,7 +384,7 @@ public class BotServices
|
||||
var settings = await SettingsProvider.GetMultipleValuesAsync([
|
||||
BuiltIn.Keys.KickEnabled, BuiltIn.Keys.HowlggEnabled, BuiltIn.Keys.ChipsggEnabled,
|
||||
BuiltIn.Keys.ClashggEnabled, BuiltIn.Keys.BetBoltEnabled, BuiltIn.Keys.YeetEnabled,
|
||||
BuiltIn.Keys.RainbetEnabled, BuiltIn.Keys.PartiEnabled
|
||||
BuiltIn.Keys.RainbetEnabled, BuiltIn.Keys.PartiEnabled, BuiltIn.Keys.JackpotEnabled
|
||||
]);
|
||||
try
|
||||
{
|
||||
@@ -422,7 +428,7 @@ public class BotServices
|
||||
await BuildHowlgg();
|
||||
}
|
||||
|
||||
if (_jackpot != null && !_jackpot.IsConnected())
|
||||
if (_jackpot != null && settings[BuiltIn.Keys.JackpotEnabled].ToBoolean() && !_jackpot.IsConnected())
|
||||
{
|
||||
_logger.Error("Jackpot died, recreating it");
|
||||
_jackpot.Dispose();
|
||||
|
||||
@@ -188,6 +188,7 @@ public class DLive(ChatBot kfChatBot) : IDisposable
|
||||
{
|
||||
logger.Error($"Bot shit itself while trying to check if {username} is live. JSON payload follows");
|
||||
logger.Error(content.GetRawText);
|
||||
logger.Error(e);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,4 +519,12 @@ public static class Money
|
||||
return payout;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a short random string based on the first 4 bytes of a GUID for event IDs
|
||||
/// </summary>
|
||||
/// <returns>Returns a lowercase hex representation of the 4 bytes. e.g. 7ec79eb2</returns>
|
||||
public static string GenerateEventId()
|
||||
{
|
||||
return Convert.ToHexString(Guid.NewGuid().ToByteArray()[..4]).ToLower();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user