Fix MenuBuilder::build sending empty messages

main
Trivernis 2 years ago
parent 74c707855d
commit c3bffd81d5

@ -13,6 +13,7 @@ use serenity::model::id::{ChannelId, UserId};
use serenity::prelude::{TypeMap, TypeMapKey};
use std::collections::HashMap;
use std::future::Future;
use std::mem;
use std::pin::Pin;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
@ -400,8 +401,15 @@ impl MenuBuilder {
.clone()
.get()
.await?;
tracing::trace!("current_page = {:?}", current_page);
let message = channel_id.send_message(ctx, |_| &mut current_page).await?;
let message = channel_id
.send_message(ctx, |msg| {
mem::swap(msg, &mut current_page);
msg
})
.await?;
tracing::trace!("message = {:?}", current_page);
tracing::debug!("Sorting controls...");
let mut controls = self

Loading…
Cancel
Save