mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-09 20:20:29 +00:00
Do rendering only once without pagination buttons, if there is only one page to display
This commit is contained in:
parent
f995852a12
commit
ed15406f51
1 changed files with 8 additions and 4 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue