use std::sync::Arc; use twilight_http::Client; use twilight_model::oauth::Application; use crate::framework::{ bot::IntoPrefixes, commands::Command, interactions::registry::ComponentRegistry, }; pub struct Runtime { pub http: Client, pub app: Application, pub registry: ComponentRegistry, pub prefixes: Arc + Send + Sync + 'static>, pub commands: Vec>>, pub state: Arc, } impl Runtime { pub async fn get_prefixes(&self, server_id: Option, user_id: Option) -> Vec { self.prefixes.clone().get(self, server_id, user_id).await } pub fn get_command(&self, name: &str) -> Option>> { self.commands .iter() .find(|cmd| { cmd.identifiers() .contains(&name.to_ascii_lowercase().as_str()) }) .cloned() } }