mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 17:20:49 +00:00
Overhaul reaction handler to a thread spawning model (#2)
* Overhaul reaction handler to a thread spawning model * Remove limits for mods on voting and community buckets
This commit is contained in:
parent
18ab9a3434
commit
10ba2dda1d
7 changed files with 183 additions and 128 deletions
|
@ -17,7 +17,7 @@ impl ReactionWatcher {
|
|||
/// Takes a copy of Context (which you can `clone`), a pager (see "Pagination") and a target channel id.
|
||||
/// Pagination will handle all events on adding/removing an "arrow" emoji (⬅️ and ➡️).
|
||||
/// This is a blocking call - it will block the thread until duration is over.
|
||||
pub fn paginate<T: Pagination>(
|
||||
pub fn paginate<T: Pagination + Send + 'static>(
|
||||
&self,
|
||||
ctx: Context,
|
||||
channel: ChannelId,
|
||||
|
@ -25,7 +25,8 @@ impl ReactionWatcher {
|
|||
duration: std::time::Duration,
|
||||
) -> CommandResult {
|
||||
let handler = PaginationHandler::new(pager, ctx, channel)?;
|
||||
self.handle_reactions(handler, duration)
|
||||
self.handle_reactions(handler, duration, |_| {});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// A version of `paginate` that compiles for closures.
|
||||
|
@ -39,7 +40,9 @@ impl ReactionWatcher {
|
|||
duration: std::time::Duration,
|
||||
) -> CommandResult
|
||||
where
|
||||
T: for<'a> FnMut(u8, &'a mut EditMessage) -> (&'a mut EditMessage, CommandResult),
|
||||
T: for<'a> FnMut(u8, &'a mut EditMessage) -> (&'a mut EditMessage, CommandResult)
|
||||
+ Send
|
||||
+ 'static,
|
||||
{
|
||||
self.paginate(ctx, channel, pager, duration)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue