From 6befbf280e83d22a47f16d8c25462fab92a09fd8 Mon Sep 17 00:00:00 2001 From: Jacob Date: Thu, 14 May 2026 00:59:45 -0400 Subject: [PATCH] chore: very beginning of making a `/render` command --- src/command/mod.rs | 2 ++ src/command/render.rs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/command/render.rs diff --git a/src/command/mod.rs b/src/command/mod.rs index 0a10112..2408adf 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -23,6 +23,7 @@ pub mod join; pub mod leave; pub mod opt_in; pub mod opt_out; +pub mod render; #[derive(Debug, Clone)] pub struct State { @@ -65,6 +66,7 @@ pub fn all() -> Vec<(&'static Command, BoxedHandler)> { (&leave::COMMAND, box_handler(leave::handle)), (&opt_in::COMMAND, box_handler(opt_in::handle)), (&opt_out::COMMAND, box_handler(opt_out::handle)), + (&render::COMMAND, box_handler(render::handle)), ] } diff --git a/src/command/render.rs b/src/command/render.rs new file mode 100644 index 0000000..877cf70 --- /dev/null +++ b/src/command/render.rs @@ -0,0 +1,32 @@ +use std::sync::LazyLock; +use twilight_model::application::{ + command::{Command, CommandType}, + interaction::Interaction, +}; +use twilight_util::builder::command::CommandBuilder; + +use crate::command::State; + +const NAME: &str = "render"; +const DESCRIPTION: &str = "(Only the bot owner can use this) Render a composite audio file from the specified range of voice chat"; + +pub static COMMAND: LazyLock = LazyLock::new(|| { + CommandBuilder::new(NAME, DESCRIPTION, CommandType::ChatInput) + .validate() + .expect("command wasn't correct") + .build() +}); + +#[tracing::instrument] +pub async fn handle(state: State, interaction: Interaction) { + let bot_owner_user_id = state.discord_bot_owner_user_id; + + let is_bot_owner = interaction + .member + .as_ref() + .and_then(|member| member.user.as_ref().map(|user| user.id)) + .map(|user_id| user_id == bot_owner_user_id) + .unwrap_or(false); + + todo!(); +}