mirror of
https://github.com/barelyprofessional/KfChatDotNet.git
synced 2026-05-11 08:39:34 -04:00
Updated mines to hopefully fix a timing bug introduced by the 15 second delay. Extended the schedule auto delete functionality so that it can apply to any message, even ones not owned by the bot.
This commit is contained in:
@@ -298,7 +298,11 @@ public class KasinoMines
|
||||
{
|
||||
await GetSavedGames(gamblerId);
|
||||
//attempt to delete the message if its there
|
||||
if (ActiveGames[gamblerId].LastMessageId != null) await _kfChatBot.KfClient.DeleteMessageAsync(ActiveGames[gamblerId].LastMessageId!);
|
||||
var lastMsgId = ActiveGames[gamblerId].LastMessageId;
|
||||
if (lastMsgId != null)
|
||||
{
|
||||
_kfChatBot.ScheduleMessageAutoDelete(lastMsgId, TimeSpan.FromSeconds(15));
|
||||
}
|
||||
ActiveGames.Remove(gamblerId);
|
||||
await SaveActiveGames(gamblerId);
|
||||
}
|
||||
@@ -337,7 +341,6 @@ public class KasinoMines
|
||||
|
||||
await _kfChatBot.SendChatMessageAsync(
|
||||
$"{game.Creator.User.FormatUsername()}, you won {await payout.FormatKasinoCurrencyAsync()} from your {await game.Wager.FormatKasinoCurrencyAsync()} bet on mines, collecting {game.BetsPlaced.Count} gems while avoiding {game.Mines} mines. Net: {await net.FormatKasinoCurrencyAsync()}. Balance: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: TimeSpan.FromSeconds(15));
|
||||
await Task.Delay(TimeSpan.FromSeconds(15));
|
||||
await RemoveGame(game.Creator.Id);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user