chore: very beginning of making a /render command
This commit is contained in:
@@ -23,6 +23,7 @@ pub mod join;
|
|||||||
pub mod leave;
|
pub mod leave;
|
||||||
pub mod opt_in;
|
pub mod opt_in;
|
||||||
pub mod opt_out;
|
pub mod opt_out;
|
||||||
|
pub mod render;
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct State {
|
pub struct State {
|
||||||
@@ -65,6 +66,7 @@ pub fn all() -> Vec<(&'static Command, BoxedHandler)> {
|
|||||||
(&leave::COMMAND, box_handler(leave::handle)),
|
(&leave::COMMAND, box_handler(leave::handle)),
|
||||||
(&opt_in::COMMAND, box_handler(opt_in::handle)),
|
(&opt_in::COMMAND, box_handler(opt_in::handle)),
|
||||||
(&opt_out::COMMAND, box_handler(opt_out::handle)),
|
(&opt_out::COMMAND, box_handler(opt_out::handle)),
|
||||||
|
(&render::COMMAND, box_handler(render::handle)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
32
src/command/render.rs
Normal file
32
src/command/render.rs
Normal 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!();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user