feat: update to songbird 0.6, make joining calls work by spawning everything as required in songbird's documentation

This commit is contained in:
2026-04-07 23:08:20 -04:00
parent 1bd8b9b203
commit 288a784870
6 changed files with 1059 additions and 48 deletions

View File

@@ -23,12 +23,12 @@ pub struct State {
}
type Return = ();
type BoxedHandler = Box<dyn Fn(State, Interaction) -> BoxFuture<'static, Return>>;
type BoxedHandler = Box<dyn Send + Sync + Fn(State, Interaction) -> BoxFuture<'static, Return>>;
fn box_handler<Handler, Fut>(handler: Handler) -> BoxedHandler
where
Fut: Future<Output = Return> + Send + 'static,
Handler: Fn(State, Interaction) -> Fut + 'static,
Handler: Send + Sync + Fn(State, Interaction) -> Fut + 'static,
{
Box::new(move |state, interaction| Box::pin(handler(state, interaction)))
}
@@ -50,7 +50,7 @@ impl Router {
fn add_route<Fut, Handler>(&mut self, name: &str, handler: Handler)
where
Fut: Future<Output = Return> + Send + 'static,
Handler: Fn(State, Interaction) -> Fut + 'static,
Handler: Send + Sync + Fn(State, Interaction) -> Fut + 'static,
{
self.add_route_already_boxed(name, box_handler(handler));
}