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:
Natsu Kagami 2024-11-04 18:23:00 +01:00 committed by GitHub
parent 7d490774e0
commit 803d718c7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 476 additions and 64 deletions

View file

@ -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.