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(()) +}