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)