From 431f295b41fbbf4b9481168130ec3981916fa674 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Sun, 25 Feb 2024 19:38:35 +0100 Subject: [PATCH] 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. --- youmubot-prelude/src/pagination.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/youmubot-prelude/src/pagination.rs b/youmubot-prelude/src/pagination.rs index 949a28d..fe5335a 100644 --- a/youmubot-prelude/src/pagination.rs +++ b/youmubot-prelude/src/pagination.rs @@ -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