Small fix (#6)

Co-authored-by: Myx <info@azaaxin.com>
This commit is contained in:
2024-08-13 03:24:29 +02:00
committed by GitHub
parent 1e2c10a7ea
commit 4ba01ed72b
4 changed files with 89 additions and 38 deletions

View File

@@ -38,6 +38,26 @@ public static class MessageModule
throw;
}
}
public static async Task RemoveMessages(this SocketSlashCommand context, DiscordSocketClient client)
{
var guildId = context.GetGuild(client).Id;
if (GuildMessageIds.TryGetValue(guildId, out var value))
{
if (value.Count <= 0)
return;
foreach (var messageId in value)
{
var messageToDelete = await context.Channel.GetMessageAsync(messageId);
if (messageToDelete != null)
await messageToDelete.DeleteAsync();
}
value.Clear();
}
}
private static async Task<ulong> StoreForRemoval(SocketSlashCommand context, DiscordSocketClient client)
{