Also try to use Discord's webhook for deletion
This commit is contained in:
parent
cee7a551d1
commit
2652f52a49
1 changed files with 11 additions and 0 deletions
|
@ -168,6 +168,17 @@ pub async fn delete_discord_message(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let channel_id = message.channel.id.parse::<ChannelId>()?;
|
let channel_id = message.channel.id.parse::<ChannelId>()?;
|
||||||
let message_id: MessageId = message.message_id.parse::<u64>()?.into();
|
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?;
|
channel_id.delete_message(&discord.ctx, message_id).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue