Put together a workaround for Clash.gg being such an awful site that mines always reports as a win no matter what

This commit is contained in:
barelyprofessional
2025-03-30 01:26:05 +08:00
parent f644c0f8cc
commit 4d11f879ca
2 changed files with 22 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
using Humanizer;
using System.Text.Json;
using Humanizer;
using KfChatDotNetBot.Models;
using KfChatDotNetBot.Models.DbModels;
using KfChatDotNetBot.Settings;
@@ -440,7 +441,7 @@ public class BotServices
$"[color={payoutColor}]{bet.Payout} {bet.Currency}[/color] ({bet.Multiplier}x) on {bet.GameName} 💰💰", true);
}
private void OnClashggBet(object sender, ClashggBetModel bet)
private void OnClashggBet(object sender, ClashggBetModel bet, JsonElement jsonElement)
{
var settings = Helpers
.GetMultipleValues([
@@ -457,6 +458,21 @@ public class BotServices
var payoutColor = settings[BuiltIn.Keys.KiwiFarmsGreenColor].Value;
if (bet.Payout < bet.Bet) payoutColor = settings[BuiltIn.Keys.KiwiFarmsRedColor].Value;
if (bet is { Game: ClashggGame.Mines, Multiplier: <= 1 })
{
var mineCount = jsonElement.GetProperty("mineCount").GetInt32();
_chatBot.SendChatMessage(
$"🚨🚨 CLASH.GG BETTING 🚨🚨 austingambles just bet {bet.Bet / 100.0:N2} {bet.Currency.Humanize()} Money on {bet.Game.Humanize()} but instantly lost with {mineCount} mines on the board. RIP 💰💰",
true);
return;
}
if (bet.Game == ClashggGame.Mines)
{
_chatBot.SendChatMessage($"🚨🚨 CLASH.GG BETTING 🚨🚨 austingambles just bet {bet.Bet / 100.0:N2} {bet.Currency.Humanize()} Money which [b]maybe[/b] paid out " +
$"{bet.Payout / 100.0:N2} {bet.Currency.Humanize()} Money ({bet.Multiplier}x) on {bet.Game.Humanize()} 💰💰", true);
return;
}
_chatBot.SendChatMessage($"🚨🚨 CLASH.GG BETTING 🚨🚨 austingambles just bet {bet.Bet / 100.0:N2} {bet.Currency.Humanize()} Money which paid out " +
$"[color={payoutColor}]{bet.Payout / 100.0:N2} {bet.Currency.Humanize()} Money[/color] ({bet.Multiplier}x) on {bet.Game.Humanize()} 💰💰", true);
}

View File

@@ -16,7 +16,7 @@ public class Clashgg : IDisposable
// Ping interval is 30 seconds
private int _reconnectTimeout = 60;
private string? _proxy;
public delegate void OnClashBetEventHandler(object sender, ClashggBetModel data);
public delegate void OnClashBetEventHandler(object sender, ClashggBetModel data, JsonElement jsonElement);
public delegate void OnWsDisconnectionEventHandler(object sender, DisconnectionInfo e);
public event OnClashBetEventHandler OnClashBet;
public event OnWsDisconnectionEventHandler OnWsDisconnection;
@@ -159,7 +159,7 @@ public class Clashgg : IDisposable
Multiplier = betPacket.Multiplier,
Payout = betPacket.BetAmount * betPacket.Multiplier
};
OnClashBet?.Invoke(this, betData);
OnClashBet?.Invoke(this, betData, packet[1]);
return;
}
@@ -181,7 +181,7 @@ public class Clashgg : IDisposable
Multiplier = (float)betPacket.Payout / betPacket.BetAmount,
Payout = betPacket.Payout
};
OnClashBet?.Invoke(this, betData);
OnClashBet?.Invoke(this, betData, packet[1]);
return;
}
@@ -200,11 +200,10 @@ public class Clashgg : IDisposable
Username = betPacket.User.Name,
Bet = betPacket.BetAmount,
Currency = betPacket.Currency == "REAL" ? ClashggCurrency.Real : ClashggCurrency.Fake,
// ReSharper disable once PossibleLossOfFraction
Multiplier = betPacket.Multiplier,
Payout = betPacket.Payout
};
OnClashBet?.Invoke(this, betData);
OnClashBet?.Invoke(this, betData, packet[1]);
return;
}