From a8853aef1c12fb77c40844a206005bd1033ccced Mon Sep 17 00:00:00 2001 From: barelyprofessional <150058423+barelyprofessional@users.noreply.github.com> Date: Sun, 12 Oct 2025 02:44:39 -0500 Subject: [PATCH] Auto cleanup not working :( trying a different method --- KfChatDotNetBot/ChatBot.cs | 4 ++-- KfChatDotNetBot/Commands/KasinoGambaCommands.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/KfChatDotNetBot/ChatBot.cs b/KfChatDotNetBot/ChatBot.cs index 1c0cfed..03f14eb 100644 --- a/KfChatDotNetBot/ChatBot.cs +++ b/KfChatDotNetBot/ChatBot.cs @@ -427,9 +427,9 @@ public class ChatBot /// /// The message you want to delete /// When you want it deleted - public async Task ScheduleMessageAutoDelete(SentMessageTrackerModel message, TimeSpan deleteAfter) + public void ScheduleMessageAutoDelete(SentMessageTrackerModel message, TimeSpan deleteAfter) { - _ = SendChatMessageAsyncAutoDeleteTask(message, deleteAfter); + _ = Task.Run(() => SendChatMessageAsyncAutoDeleteTask(message, deleteAfter), _cancellationToken); } private async Task SendChatMessageAsyncAutoDeleteTask(SentMessageTrackerModel message, TimeSpan deleteAfter) diff --git a/KfChatDotNetBot/Commands/KasinoGambaCommands.cs b/KfChatDotNetBot/Commands/KasinoGambaCommands.cs index b53db04..370c1cf 100644 --- a/KfChatDotNetBot/Commands/KasinoGambaCommands.cs +++ b/KfChatDotNetBot/Commands/KasinoGambaCommands.cs @@ -176,7 +176,7 @@ public class KenoCommand : ICommand await botInstance.SendChatMessageAsync( $"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsGreenColor].Value}]won {await win.FormatKasinoCurrencyAsync()} with a {payoutMulti}x multi![/color]. Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}.", true, autoDeleteAfter: cleanupDelay); - await botInstance.ScheduleMessageAutoDelete(_kenoTable, cleanupDelay); + botInstance.ScheduleMessageAutoDelete(_kenoTable, cleanupDelay); } private async Task AnimatedDisplayTable(List playerNumbers, List casinoNumbers, List matches, ChatBot botInstance) @@ -494,7 +494,7 @@ public class Planes : ICommand await botInstance.SendChatMessageAsync( $"{user.FormatUsername()}, you [color={colors[BuiltIn.Keys.KiwiFarmsRedColor].Value}]crashed![/color] Your balance is now: {await newBalance.FormatKasinoCurrencyAsync()}", true, autoDeleteAfter: cleanupDelay); - await botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay); + botInstance.ScheduleMessageAutoDelete(msgId, cleanupDelay); } private string GetPreGameBoard(int fullCounter, int[,] planesBoard, Plane plane, int carrierCount, bool noseUp)