mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-02 04:22:04 -04:00
Compare commits
6 Commits
7981f57a34
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf62274b4b | ||
|
|
972e880aa9 | ||
|
|
f5f0ba6323 | ||
|
|
ab94098dd2 | ||
|
|
c79105bb44 | ||
|
|
000c87266e |
@@ -18,7 +18,8 @@ public class GetBalanceCommand : ICommand
|
||||
{
|
||||
public List<Regex> Patterns => [
|
||||
new Regex("^balance", RegexOptions.IgnoreCase),
|
||||
new Regex("^bal$", RegexOptions.IgnoreCase)
|
||||
new Regex("^bal$", RegexOptions.IgnoreCase),
|
||||
new Regex("^bal exact$", RegexOptions.IgnoreCase)
|
||||
];
|
||||
public string? HelpText => "Get your gamba balance";
|
||||
public UserRight RequiredRight => UserRight.Loser;
|
||||
@@ -30,8 +31,17 @@ public class GetBalanceCommand : ICommand
|
||||
CancellationToken ctx)
|
||||
{
|
||||
var gambler = await Money.GetGamblerEntityAsync(user.Id, ct: ctx);
|
||||
if (message.MessageRawHtmlDecoded.EndsWith("exact"))
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance is {gambler!.Balance}", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance is {await gambler!.Balance.FormatKasinoCurrencyAsync()}", true);
|
||||
}
|
||||
|
||||
|
||||
if (botInstance.BotServices.KasinoShop != null)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ public class KrashBetCommand : ICommand
|
||||
if (wager > gambler.Balance)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync(
|
||||
$"{user.FormatUsername()}, your balance of {gambler.Balance} is not enough to bet {wager} on krash.",
|
||||
$"{user.FormatUsername()}, your balance of {await gambler.Balance.FormatKasinoCurrencyAsync()} is not enough to bet {wager} on krash.",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(5));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RouletteCommand : ICommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(settings[BuiltIn.Keys.BotRedisConnectionString].Value))
|
||||
if (!Redis.IsAvailable)
|
||||
{
|
||||
await botInstance.SendChatMessageAsync($"{user.FormatUsername()}, roulette is not available at this time", true,
|
||||
autoDeleteAfter: TimeSpan.FromSeconds(15));
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
using System.Text;
|
||||
using KfChatDotNetBot.Services;
|
||||
using KfChatDotNetBot.Settings;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NLog;
|
||||
@@ -38,9 +39,19 @@ namespace KfChatDotNetBot
|
||||
await BuiltIn.SyncSettingsWithDb();
|
||||
logger.Info("Migrating settings from config.json (if needed)");
|
||||
await BuiltIn.MigrateJsonSettingsToDb();
|
||||
logger.Info("Attempting to grab the Redis connection multiplexer so it's built");
|
||||
try
|
||||
{
|
||||
_ = Redis.Multiplexer;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
logger.Error("Caught an error when attempting to grab the Redis multiplexer");
|
||||
logger.Error(e);
|
||||
}
|
||||
logger.Info("Handing over to bot now");
|
||||
Console.OutputEncoding = Encoding.UTF8;
|
||||
new ChatBot();
|
||||
_ = new ChatBot();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -390,12 +390,13 @@ public class BotServices
|
||||
_logger.Info("Built the almanac shill task");
|
||||
}
|
||||
|
||||
private Task BuildDLiveStatusCheck()
|
||||
private async Task BuildDLiveStatusCheck()
|
||||
{
|
||||
var enabled = (await SettingsProvider.GetValueAsync(BuiltIn.Keys.DLiveEnabled)).ToBoolean();
|
||||
if (!enabled) return;
|
||||
_dliveStatusCheck = new DLive(_chatBot);
|
||||
_dliveStatusCheck.StartLiveStatusCheck();
|
||||
_logger.Info("Built the DLive livestream status check task");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private Task BuildPeerTubeLiveStatusCheck()
|
||||
|
||||
@@ -202,7 +202,6 @@ public class KasinoKrash : IDisposable
|
||||
await _kfChatBot.SendChatMessageAsync(
|
||||
$"{bet.Gambler.User.FormatUsername()}, due to your poor gambling skills, your bet was scaled down to {await bet.Wager.FormatKasinoCurrencyAsync()} to match your remaining balance.",
|
||||
true, autoDeleteAfter: TimeSpan.FromSeconds(10));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (bet.Multi <= TheGame.FinalMulti && bet.Multi != -1)
|
||||
|
||||
@@ -586,6 +586,9 @@ public static class BuiltIn
|
||||
public static string WinnaBmjUsername = "Winna.BmjUsername";
|
||||
[BuiltInSetting("Array of cookies as a shitty hack to get Winna going", SettingValueType.Array, "[]")]
|
||||
public static string WinnaCookies = "Winna.Cookies";
|
||||
[BuiltInSetting("Whether the DLive livestream check is enabled", SettingValueType.Boolean, "false",
|
||||
BooleanRegex)]
|
||||
public static string DLiveEnabled = "DLive.Enabled";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user