mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 17:20:49 +00:00
osu: implement beatmapset and simulate button (#55)
* Prepare a message beforehand for display_beatmapset * Implement a Beatmapset button * Always sort top plays by pp * Show leaderboard for top pp per user/mod only * Add score simulation * Store all reaction to be removed later * Properly handle errors * Parse beatmap to get placeholders for modal * Make buttons same color
This commit is contained in:
parent
7d490774e0
commit
803d718c7a
10 changed files with 476 additions and 64 deletions
|
@ -27,6 +27,9 @@ pub trait Paginate: Send + Sized {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Cleans up after the pagination has timed out.
|
||||
async fn cleanup(&mut self, _ctx: &Context, _m: &mut Message) -> () {}
|
||||
|
||||
/// Handle the incoming reaction. Defaults to calling `handle_pagination_reaction`, but you can do some additional handling
|
||||
/// before handing the functionality over.
|
||||
///
|
||||
|
@ -116,6 +119,10 @@ impl<Inner: Paginate> Paginate for WithPageCount<Inner> {
|
|||
fn is_empty(&self) -> Option<bool> {
|
||||
Some(self.page_count == 0)
|
||||
}
|
||||
|
||||
async fn cleanup(&mut self, ctx: &Context, msg: &mut Message) {
|
||||
self.inner.cleanup(ctx, msg).await;
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
|
@ -240,6 +247,8 @@ pub async fn paginate_with_first_message(
|
|||
}
|
||||
};
|
||||
|
||||
pager.cleanup(ctx, &mut message).await;
|
||||
|
||||
for reaction in reactions {
|
||||
if reaction.delete_all(&ctx).await.pls_ok().is_none() {
|
||||
// probably no permission to delete all reactions, fall back to delete my own.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue