From e365c6f81fd51f90742035152d5bed23d3774ebd Mon Sep 17 00:00:00 2001 From: louis1706 Date: Fri, 25 Aug 2023 16:09:36 +0200 Subject: [PATCH] PingTrigger Deleted --- BLART/Modules/PingTriggers.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BLART/Modules/PingTriggers.cs b/BLART/Modules/PingTriggers.cs index ef686f9..fb5e4a8 100755 --- a/BLART/Modules/PingTriggers.cs +++ b/BLART/Modules/PingTriggers.cs @@ -28,7 +28,13 @@ public static async Task HandleMessage(SocketMessage msg) string triggerMessage = DatabaseHandler.GetPingTrigger(mentioned.Id); if (!string.IsNullOrEmpty(triggerMessage) && triggerMessage.Length < Program.Config.TriggerLengthLimit) { - await msg.Channel.SendMessageAsync(embed: await EmbedBuilderService.CreateBasicEmbed("Ping Trigger", $"{msg.Author.Mention} - {triggerMessage}", Color.Gold)); + var sentMessage = await msg.Channel.SendMessageAsync(embed: await EmbedBuilderService.CreateBasicEmbed("Ping Trigger", $"{msg.Author.Mention} - {triggerMessage}", Color.Gold)); + + await Task.Delay(TimeSpan.FromSeconds(120)).ContinueWith(async _ => + { + await sentMessage.DeleteAsync(); + }); + _lastPing[msg.Author] = DateTime.UtcNow; break; }