mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 17:20:49 +00:00
Change pagination to use interactions instead of reactions
This commit is contained in:
parent
460624c7fe
commit
d1f3aa5fa9
8 changed files with 281 additions and 227 deletions
|
@ -66,25 +66,23 @@ async fn message_command(
|
|||
}
|
||||
let images = std::sync::Arc::new(images);
|
||||
paginate_reply(
|
||||
paginate_from_fn(|page, ctx, msg: &mut Message| {
|
||||
paginate_from_fn(|page, _, _, btns| {
|
||||
let images = images.clone();
|
||||
Box::pin(async move {
|
||||
let page = page as usize;
|
||||
if page >= images.len() {
|
||||
Ok(false)
|
||||
Ok(None)
|
||||
} else {
|
||||
msg.edit(
|
||||
ctx,
|
||||
EditMessage::new().content(format!(
|
||||
"[🖼️ **{}/{}**] Here's the image you requested!\n\n{}",
|
||||
page + 1,
|
||||
images.len(),
|
||||
images[page]
|
||||
)),
|
||||
)
|
||||
.await
|
||||
.map(|_| true)
|
||||
.map_err(|e| e.into())
|
||||
Ok(Some(
|
||||
EditMessage::new()
|
||||
.content(format!(
|
||||
"[🖼️ **{}/{}**] Here's the image you requested!\n\n{}",
|
||||
page + 1,
|
||||
images.len(),
|
||||
images[page]
|
||||
))
|
||||
.components(vec![btns]),
|
||||
))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue