Do rendering only once without pagination buttons, if there is only one page to display

This commit is contained in:
Natsu Kagami 2025-03-10 15:02:16 +01:00
parent f995852a12
commit ed15406f51
Signed by: nki
GPG key ID: 55A032EB38B49ADB

View file

@ -251,14 +251,18 @@ pub async fn paginate_with_first_message(
mut message: impl CanEdit,
timeout: std::time::Duration,
) -> Result<()> {
// Just quit if there is only one page
if pager.len().filter(|&v| v == 1).is_some() {
do_render_with_btns(&mut pager, 0, &mut message, vec![])
.await
.pls_ok();
return Ok(());
}
let msg_id = message.get_message().await?.id;
let recv = crate::InteractionCollector::create(ctx, msg_id).await?;
do_render(&mut pager, 0, &mut message).await?;
// Just quit if there is only one page
if pager.len().filter(|&v| v == 1).is_some() {
return Ok(());
}
let mut page = 0;
// Loop the handler function.