feat: add four skeletons of commands
This commit is contained in:
24
src/command/join.rs
Normal file
24
src/command/join.rs
Normal file
@@ -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<Command> = 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!();
|
||||||
|
}
|
||||||
24
src/command/leave.rs
Normal file
24
src/command/leave.rs
Normal file
@@ -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<Command> = 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!();
|
||||||
|
}
|
||||||
@@ -9,6 +9,10 @@ use twilight_model::application::{
|
|||||||
command::Command, interaction::application_command::CommandData,
|
command::Command, interaction::application_command::CommandData,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mod join;
|
||||||
|
mod leave;
|
||||||
|
mod opt_out;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct State {}
|
pub struct State {}
|
||||||
|
|
||||||
@@ -24,7 +28,11 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn all() -> Vec<(&'static Command, BoxedHandler)> {
|
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)]
|
#[derive(Default)]
|
||||||
|
|||||||
24
src/command/opt_out.rs
Normal file
24
src/command/opt_out.rs
Normal file
@@ -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<Command> = 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!();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user