Also try to use Discord's webhook for deletion

main
Charlotte Som 2022-04-17 13:06:11 +01:00
parent cee7a551d1
commit 2652f52a49
1 changed files with 11 additions and 0 deletions

View File

@ -168,6 +168,17 @@ pub async fn delete_discord_message(
) -> Result<()> {
let channel_id = message.channel.id.parse::<ChannelId>()?;
let message_id: MessageId = message.message_id.parse::<u64>()?.into();
if let Some(webhook) = get_or_create_webhook_for_channel(&mut *discord, &channel_id).await {
if webhook
.delete_message(&discord.ctx, message_id)
.await
.is_ok()
{
return Ok(());
}
}
channel_id.delete_message(&discord.ctx, message_id).await?;
Ok(())
}