chore: very beginning of making a /render command

This commit is contained in:
2026-05-14 00:59:45 -04:00
parent b2af146360
commit 6befbf280e
2 changed files with 34 additions and 0 deletions

View File

@@ -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)),
]
}

32
src/command/render.rs Normal file
View File

@@ -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<Command> = 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!();
}