From 0973dbc7251e0db99e3af939c6614161de7c025b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Czy=C5=BC?= Date: Tue, 30 Jan 2024 15:20:39 +0100 Subject: [PATCH] reformatting --- src/commands/music/deafen.rs | 23 +++++++++++++---------- src/commands/music/join.rs | 6 +++--- src/commands/music/leave.rs | 9 ++++++--- src/commands/music/mod.rs | 5 +++-- src/main.rs | 12 ++++-------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/commands/music/deafen.rs b/src/commands/music/deafen.rs index e88dd08..130e40d 100644 --- a/src/commands/music/deafen.rs +++ b/src/commands/music/deafen.rs @@ -1,7 +1,7 @@ -use serenity::model::prelude::*; -use serenity::prelude::*; use serenity::framework::standard::macros::command; use serenity::framework::standard::CommandResult; +use serenity::model::prelude::*; +use serenity::prelude::*; use crate::commands::misc::check_msg; @@ -11,16 +11,16 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult { let guild_id = msg.guild_id.unwrap(); let manager = songbird::get(ctx) - .await - .expect("Client placed at init") - .clone(); + .await + .expect("Client placed at init") + .clone(); let handler_lock = match manager.get(guild_id) { Some(handler) => handler, None => { check_msg(msg.reply(ctx, "Not in a voice channel").await); - return Ok(()) + return Ok(()); } }; @@ -28,14 +28,17 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult { if handler.is_deaf() { check_msg(msg.channel_id.say(&ctx.http, "Already deafened").await); - } - else { + } else { if let Err(err) = handler.deafen(true).await { - check_msg(msg.channel_id.say(&ctx.http, format!("Failed: {:?}", err)).await); + check_msg( + msg.channel_id + .say(&ctx.http, format!("Failed: {:?}", err)) + .await, + ); } check_msg(msg.channel_id.say(&ctx.http, "Deafened").await); } Ok(()) -} \ No newline at end of file +} diff --git a/src/commands/music/join.rs b/src/commands/music/join.rs index 3c0bf9a..fe734aa 100644 --- a/src/commands/music/join.rs +++ b/src/commands/music/join.rs @@ -1,8 +1,8 @@ use serenity::async_trait; -use serenity::model::prelude::*; -use serenity::prelude::*; use serenity::framework::standard::macros::command; use serenity::framework::standard::CommandResult; +use serenity::model::prelude::*; +use serenity::prelude::*; use songbird::events::{Event, EventContext, EventHandler as VoiceEventHandler, TrackEvent}; use crate::commands::misc::check_msg; @@ -58,4 +58,4 @@ impl VoiceEventHandler for TrackErrorNotifier { } None } -} \ No newline at end of file +} diff --git a/src/commands/music/leave.rs b/src/commands/music/leave.rs index 8c6b2f2..952ecdb 100644 --- a/src/commands/music/leave.rs +++ b/src/commands/music/leave.rs @@ -19,12 +19,15 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult { if has_handler { if let Err(err) = manager.remove(guild_id).await { - check_msg(msg.channel_id.say(&ctx.http, format!("Failed: {:?}", err)).await); + check_msg( + msg.channel_id + .say(&ctx.http, format!("Failed: {:?}", err)) + .await, + ); } check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await); - } - else { + } else { check_msg(msg.reply(ctx, "Not in a voice channel").await); } diff --git a/src/commands/music/mod.rs b/src/commands/music/mod.rs index bc0376f..ae89599 100644 --- a/src/commands/music/mod.rs +++ b/src/commands/music/mod.rs @@ -1,3 +1,4 @@ -pub mod join; pub mod deafen; -pub mod leave; \ No newline at end of file +pub mod join; +pub mod leave; +pub mod mute; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index d36a188..68bc09b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,10 +8,7 @@ use serenity::{ async_trait, client::{Client, EventHandler}, framework::{ - standard::{ - macros::group, - Configuration, - }, + standard::{macros::group, Configuration}, StandardFramework, }, model::gateway::Ready, @@ -20,9 +17,10 @@ use serenity::{ mod commands; -use crate::commands::music::join::*; use crate::commands::music::deafen::*; +use crate::commands::music::join::*; use crate::commands::music::leave::*; +use crate::commands::music::mute::*; struct HttpKey; @@ -40,9 +38,7 @@ impl EventHandler for Handler { } #[group] -#[commands( - join, deafen, leave -)] +#[commands(join, deafen, leave, mute)] struct General; #[tokio::main]