From f53b4efee053f5c8d9861f19003af361f58df7ce Mon Sep 17 00:00:00 2001 From: Oupson Date: Mon, 24 Aug 2020 17:31:11 +0200 Subject: [PATCH] Small fix --- src/commands/music.rs | 5 +++-- src/main.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/commands/music.rs b/src/commands/music.rs index c39fa0b..156b395 100644 --- a/src/commands/music.rs +++ b/src/commands/music.rs @@ -98,9 +98,10 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult { .cloned() .expect("Expected VoiceManager in TypeMap."); let mut manager = manager_lock.lock().await; - let has_handler = manager.get(guild_id).is_some(); - if has_handler { + + if let Some(handler) = manager.get_mut(guild_id) { + handler.stop(); manager.remove(guild_id); check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await); diff --git a/src/main.rs b/src/main.rs index c294ba6..f2f7f49 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,11 +3,13 @@ use crate::commands::{ roulette::{BulletsContainer, ROULETTE_GROUP}, }; use async_trait::async_trait; +use serde_json::Value; use serenity::{ framework::standard::{ help_commands, macros::{help, hook}, - Args, CommandGroup, CommandResult, DispatchError, HelpOptions, StandardFramework, CommandError, + Args, CommandError, CommandGroup, CommandResult, DispatchError, HelpOptions, + StandardFramework, }, http::Http, model::prelude::*, @@ -21,7 +23,6 @@ use std::{ time::Duration, }; use tokio::{fs::File, io::AsyncWriteExt}; -use serde_json::Value; #[cfg(feature = "music")] use crate::commands::music::{VoiceManager, MUSIC_GROUP};