mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 20:36:10 +01:00
38 lines
1.0 KiB
Rust
38 lines
1.0 KiB
Rust
use serenity::framework::standard::macros::command;
|
|
use serenity::framework::standard::CommandResult;
|
|
use serenity::model::prelude::*;
|
|
use serenity::prelude::*;
|
|
|
|
use crate::commands::misc::check_msg;
|
|
|
|
#[command]
|
|
#[only_in(guilds)]
|
|
async fn unmute(ctx: &Context, msg: &Message) -> CommandResult {
|
|
let guild_id = msg.guild_id.unwrap();
|
|
|
|
let manager = songbird::get(ctx)
|
|
.await
|
|
.expect("Client placed at init")
|
|
.clone();
|
|
|
|
if let Some(handler_lock) = manager.get(guild_id) {
|
|
let mut handler = handler_lock.lock().await;
|
|
if let Err(e) = handler.mute(false).await {
|
|
check_msg(
|
|
msg.channel_id
|
|
.say(&ctx.http, format!("Failed: {:?}", e))
|
|
.await,
|
|
);
|
|
}
|
|
|
|
check_msg(msg.channel_id.say(&ctx.http, "Unmuted").await);
|
|
} else {
|
|
check_msg(
|
|
msg.channel_id
|
|
.say(&ctx.http, "Not in a voice channel to unmute in")
|
|
.await,
|
|
);
|
|
}
|
|
|
|
Ok(())
|
|
} |