From 30c4761fe0b518fc9ed973963df62b8839a0bcbc Mon Sep 17 00:00:00 2001 From: Jacob Date: Tue, 24 Mar 2026 01:49:01 -0400 Subject: [PATCH] feat: add four skeletons of commands --- src/command/join.rs | 24 ++++++++++++++++++++++++ src/command/leave.rs | 24 ++++++++++++++++++++++++ src/command/mod.rs | 10 +++++++++- src/command/opt_out.rs | 24 ++++++++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/command/join.rs create mode 100644 src/command/leave.rs create mode 100644 src/command/opt_out.rs diff --git a/src/command/join.rs b/src/command/join.rs new file mode 100644 index 0000000..662be21 --- /dev/null +++ b/src/command/join.rs @@ -0,0 +1,24 @@ +use std::sync::LazyLock; + +use twilight_model::application::{ + command::{Command, CommandType}, + interaction::application_command::CommandData, +}; +use twilight_util::builder::command::CommandBuilder; + +use crate::command::State; + +const NAME: &str = "join"; +const DESCRIPTION: &str = "The bot will join the same VC as you (with intention to record)"; + +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, data: CommandData) { + todo!(); +} diff --git a/src/command/leave.rs b/src/command/leave.rs new file mode 100644 index 0000000..503ec5a --- /dev/null +++ b/src/command/leave.rs @@ -0,0 +1,24 @@ +use std::sync::LazyLock; + +use twilight_model::application::{ + command::{Command, CommandType}, + interaction::application_command::CommandData, +}; +use twilight_util::builder::command::CommandBuilder; + +use crate::command::State; + +const NAME: &str = "leave"; +const DESCRIPTION: &str = "The bot will leave the VC it's in (so it won't record anyone anymore)"; + +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, data: CommandData) { + todo!(); +} diff --git a/src/command/mod.rs b/src/command/mod.rs index 2efbc06..61de949 100644 --- a/src/command/mod.rs +++ b/src/command/mod.rs @@ -9,6 +9,10 @@ use twilight_model::application::{ command::Command, interaction::application_command::CommandData, }; +mod join; +mod leave; +mod opt_out; + #[derive(Debug, Clone)] pub struct State {} @@ -24,7 +28,11 @@ where } pub fn all() -> Vec<(&'static Command, BoxedHandler)> { - vec![] + vec![ + (&join::COMMAND, box_handler(join::handle)), + (&leave::COMMAND, box_handler(leave::handle)), + (&opt_out::COMMAND, box_handler(opt_out::handle)), + ] } #[derive(Default)] diff --git a/src/command/opt_out.rs b/src/command/opt_out.rs new file mode 100644 index 0000000..137182e --- /dev/null +++ b/src/command/opt_out.rs @@ -0,0 +1,24 @@ +use std::sync::LazyLock; + +use twilight_model::application::{ + command::{Command, CommandType}, + interaction::application_command::CommandData, +}; +use twilight_util::builder::command::CommandBuilder; + +use crate::command::State; + +const NAME: &str = "opt-out"; +const DESCRIPTION: &str = "Opt out of being recorded (duration option TODO)"; + +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, data: CommandData) { + todo!(); +}