Small fix

This commit is contained in:
Oupson 2020-08-24 17:31:11 +02:00
parent 8055cbb78f
commit f53b4efee0
2 changed files with 6 additions and 4 deletions

View File

@ -98,9 +98,10 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
.cloned() .cloned()
.expect("Expected VoiceManager in TypeMap."); .expect("Expected VoiceManager in TypeMap.");
let mut manager = manager_lock.lock().await; 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); manager.remove(guild_id);
check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await); check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await);

View File

@ -3,11 +3,13 @@ use crate::commands::{
roulette::{BulletsContainer, ROULETTE_GROUP}, roulette::{BulletsContainer, ROULETTE_GROUP},
}; };
use async_trait::async_trait; use async_trait::async_trait;
use serde_json::Value;
use serenity::{ use serenity::{
framework::standard::{ framework::standard::{
help_commands, help_commands,
macros::{help, hook}, macros::{help, hook},
Args, CommandGroup, CommandResult, DispatchError, HelpOptions, StandardFramework, CommandError, Args, CommandError, CommandGroup, CommandResult, DispatchError, HelpOptions,
StandardFramework,
}, },
http::Http, http::Http,
model::prelude::*, model::prelude::*,
@ -21,7 +23,6 @@ use std::{
time::Duration, time::Duration,
}; };
use tokio::{fs::File, io::AsyncWriteExt}; use tokio::{fs::File, io::AsyncWriteExt};
use serde_json::Value;
#[cfg(feature = "music")] #[cfg(feature = "music")]
use crate::commands::music::{VoiceManager, MUSIC_GROUP}; use crate::commands::music::{VoiceManager, MUSIC_GROUP};