Format and cleanup code
This commit is contained in:
@@ -6,7 +6,7 @@ use serenity::prelude::*;
|
||||
|
||||
use crate::data::guilds::GuildCache;
|
||||
use super::{commands, oai};
|
||||
use super::commands::create_response;
|
||||
use super::chat::create_response;
|
||||
|
||||
pub struct Handler {
|
||||
// Open AI Config
|
||||
@@ -42,32 +42,6 @@ impl EventHandler for Handler {
|
||||
}
|
||||
}
|
||||
|
||||
async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
|
||||
if let Interaction::Command(command) = interaction {
|
||||
log::trace!("Received command interaction: {command:#?}");
|
||||
match command.data.name.as_str() {
|
||||
// Match commands without returns
|
||||
"play" => commands::audio::play::run(&ctx, &command).await,
|
||||
"stop" => commands::audio::stop::run(&ctx, &command).await,
|
||||
"pause" => commands::audio::pause::run(&ctx, &command).await,
|
||||
"resume" => commands::audio::resume::run(&ctx, &command).await,
|
||||
"mute" => commands::audio::mute::run(&ctx, &command).await,
|
||||
"skip" => commands::audio::skip::run(&ctx, &command).await,
|
||||
"volume" => commands::audio::volume::run(&ctx, &command).await,
|
||||
"schedule" => commands::event::schedule::run(&ctx, &command).await,
|
||||
"roll" => commands::fun::roll::run(&ctx, &command).await,
|
||||
_ => {
|
||||
let content: String = match command.data.name.as_str() {
|
||||
// Match commands with string returns
|
||||
"ping" => commands::utility::ping::run(&command.data.options),
|
||||
_ => "Unknown command".to_string(),
|
||||
};
|
||||
create_response(&ctx, &command, content, false).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn ready(&self, ctx: Context, ready: Ready) {
|
||||
if ready.guilds.is_empty() {
|
||||
log::warn!("No ready guilds found");
|
||||
@@ -116,4 +90,30 @@ impl EventHandler for Handler {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
async fn interaction_create(&self, ctx: Context, interaction: Interaction) {
|
||||
if let Interaction::Command(command) = interaction {
|
||||
log::trace!("Received command interaction: {command:#?}");
|
||||
match command.data.name.as_str() {
|
||||
// Match commands without returns
|
||||
"play" => commands::audio::play::run(&ctx, &command).await,
|
||||
"stop" => commands::audio::stop::run(&ctx, &command).await,
|
||||
"pause" => commands::audio::pause::run(&ctx, &command).await,
|
||||
"resume" => commands::audio::resume::run(&ctx, &command).await,
|
||||
"mute" => commands::audio::mute::run(&ctx, &command).await,
|
||||
"skip" => commands::audio::skip::run(&ctx, &command).await,
|
||||
"volume" => commands::audio::volume::run(&ctx, &command).await,
|
||||
"schedule" => commands::event::schedule::run(&ctx, &command).await,
|
||||
"roll" => commands::fun::roll::run(&ctx, &command).await,
|
||||
_ => {
|
||||
let content: String = match command.data.name.as_str() {
|
||||
// Match commands with string returns
|
||||
"ping" => commands::utility::ping::run(&command.data.options),
|
||||
_ => "Unknown command".to_string(),
|
||||
};
|
||||
create_response(&ctx, &command, content, false).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user