Rust Migration

This commit is contained in:
2023-07-04 14:10:56 -04:00
parent 1507e878dc
commit 1d9cd4adcf
23 changed files with 2602 additions and 278 deletions

View File

@@ -0,0 +1,6 @@
pub mod pause;
pub mod play;
pub mod resume;
pub mod skip;
pub mod stop;
pub mod volume;

View File

View File

@@ -0,0 +1,18 @@
use log::debug;
use serenity::{model::prelude::{interaction::application_command::CommandDataOption, application_command::CommandDataOptionValue}, builder::CreateApplicationCommand};
use serenity::model::application::interaction::application_command::ApplicationCommandInteraction;
pub async fn run(command: &ApplicationCommandInteraction) -> String {
let track_option: &CommandDataOptionValue = command.data.options.get(0).expect("Expected track option").resolved.as_ref().expect("Expected track option to be resolved");
debug!("Play command executed with track: {:?}", track_option);
"Playing xyz".to_string()
}
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("play").description("Plays the given track").create_option(|option| { option
.name("track")
.description("The track to be played")
.kind(serenity::model::prelude::command::CommandOptionType::String)
.required(true)
})
}

View File

View File

View File

View File

0
src/commands/help.rs Normal file
View File

2
src/commands/mod.rs Normal file
View File

@@ -0,0 +1,2 @@
pub mod ping;
pub mod audio;

11
src/commands/ping.rs Normal file
View File

@@ -0,0 +1,11 @@
use log::debug;
use serenity::{model::prelude::interaction::application_command::CommandDataOption, builder::CreateApplicationCommand};
pub fn run(_options: &[CommandDataOption]) -> String {
debug!("Ping command executed");
"pong".to_string()
}
pub fn register(command: &mut CreateApplicationCommand) -> &mut CreateApplicationCommand {
command.name("ping").description("Replies with pong")
}