feat: early steps of storage and configuration

This commit is contained in:
2026-04-09 22:39:02 -04:00
parent 7d3a309d2b
commit 7885526944
14 changed files with 393 additions and 54 deletions

View File

@@ -1,6 +1,7 @@
use std::{fmt::Debug, sync::Arc};
use futures::future::BoxFuture;
use opendal::Operator;
use patricia_tree::StringPatriciaMap;
use songbird::Songbird;
use tokio_util::sync::CancellationToken;
@@ -14,18 +15,23 @@ use twilight_model::{
use crate::VCs;
mod debug;
mod join;
mod leave;
mod opt_in;
mod opt_out;
#[derive(Debug, Clone)]
pub struct State {
pub bot_data: Operator,
pub cancellation_token: CancellationToken,
pub discord_application_id: Id<ApplicationMarker>,
pub discord_bot_owner_user_id: Id<UserMarker>,
pub discord_client: Arc<twilight_http::Client>,
pub discord_user_id: Id<UserMarker>,
pub recording_data: Operator,
pub songbird: Arc<Songbird>,
pub user_data: Operator,
pub vcs: Arc<VCs>,
}
@@ -42,8 +48,10 @@ where
pub fn all() -> Vec<(&'static Command, BoxedHandler)> {
vec![
(&debug::COMMAND, box_handler(debug::handle)),
(&join::COMMAND, box_handler(join::handle)),
(&leave::COMMAND, box_handler(leave::handle)),
(&opt_in::COMMAND, box_handler(opt_in::handle)),
(&opt_out::COMMAND, box_handler(opt_out::handle)),
]
}
@@ -54,7 +62,7 @@ pub struct Router {
}
impl Router {
fn add_route<Fut, Handler>(&mut self, name: &str, handler: Handler)
pub fn add_route<Fut, Handler>(&mut self, name: &str, handler: Handler)
where
Fut: Future<Output = Return> + Send + 'static,
Handler: Send + Sync + Fn(State, Interaction) -> Fut + 'static,