From 086ed93a512189a946f98766f444eedeef592310 Mon Sep 17 00:00:00 2001 From: jude-lafitteIII Date: Fri, 22 May 2020 15:28:25 +0100 Subject: [PATCH] stop command --- src/main.rs | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index d8e1db9..3c39902 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,7 +115,7 @@ lazy_static! { struct AllUsers; #[group] -#[commands(play, upload_new_sound, change_volume, delete_sound)] +#[commands(play, upload_new_sound, change_volume, delete_sound, stop_playing)] #[checks(role_check)] struct RoleManagedUsers; @@ -397,11 +397,8 @@ async fn disconnect_from_inactive(voice_manager_mutex: Arc CommandResult { + let voice_manager_lock = ctx.data.read().await + .get::().cloned().expect("Could not get VoiceManager from data"); + + let mut voice_manager = voice_manager_lock.lock().await; + + let manager_opt = voice_manager.get_mut(msg.guild_id.unwrap()); + + if let Some(manager) = manager_opt { + manager.leave(); + } + + Ok(()) +}