Pagination: just delete our own reaction as fallback

... happens if we don't have message management permissions.
We definitely don't want to vomit errors to the user.
This commit is contained in:
Natsu Kagami 2024-02-25 19:38:35 +01:00 committed by Natsu Kagami
parent 2a279e62e4
commit 431f295b41

View file

@ -1,4 +1,4 @@
use crate::{Context, Result};
use crate::{Context, OkPrint, Result};
use futures_util::{future::Future, StreamExt as _};
use serenity::{
builder::CreateMessage,
@ -174,7 +174,10 @@ async fn paginate_with_first_message(
};
for reaction in reactions {
reaction.delete_all(&ctx).await?;
if let None = reaction.delete_all(&ctx).await.pls_ok() {
// probably no permission to delete all reactions, fall back to delete my own.
reaction.delete(&ctx).await.pls_ok();
}
}
res