From 0e83f8e6cc73979ae1e7ec0afa92b7bd65c37f0a Mon Sep 17 00:00:00 2001 From: Filip Strajnar Date: Sun, 16 Jun 2024 01:46:56 +0200 Subject: [PATCH] If message isn't found, don't try to delete it. --- DiscordDelete/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/DiscordDelete/Program.cs b/DiscordDelete/Program.cs index f947195..5100705 100644 --- a/DiscordDelete/Program.cs +++ b/DiscordDelete/Program.cs @@ -26,6 +26,12 @@ int finalCode = await CommandLine if (message.MessageId is null || message.ChannelId is null) continue; + if (message.LastHttpCode == 404) + { + Console.WriteLine($"{message.MessageId} Not found - Skipping."); + continue; + } + HttpResponseMessage response = await client.DeleteMessage( message.ChannelId, message.MessageId