Rust Migration
This commit is contained in:
6
src/commands/audio/mod.rs
Normal file
6
src/commands/audio/mod.rs
Normal file
@@ -0,0 +1,6 @@
|
||||
pub mod pause;
|
||||
pub mod play;
|
||||
pub mod resume;
|
||||
pub mod skip;
|
||||
pub mod stop;
|
||||
pub mod volume;
|
||||
0
src/commands/audio/pause.rs
Normal file
0
src/commands/audio/pause.rs
Normal file
18
src/commands/audio/play.rs
Normal file
18
src/commands/audio/play.rs
Normal 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)
|
||||
})
|
||||
}
|
||||
0
src/commands/audio/resume.rs
Normal file
0
src/commands/audio/resume.rs
Normal file
0
src/commands/audio/skip.rs
Normal file
0
src/commands/audio/skip.rs
Normal file
0
src/commands/audio/stop.rs
Normal file
0
src/commands/audio/stop.rs
Normal file
0
src/commands/audio/volume.rs
Normal file
0
src/commands/audio/volume.rs
Normal file
0
src/commands/help.rs
Normal file
0
src/commands/help.rs
Normal file
2
src/commands/mod.rs
Normal file
2
src/commands/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub mod ping;
|
||||
pub mod audio;
|
||||
11
src/commands/ping.rs
Normal file
11
src/commands/ping.rs
Normal 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")
|
||||
}
|
||||
Reference in New Issue
Block a user