songbird music support init

This commit is contained in:
2024-01-30 15:17:36 +01:00
parent edcf79cf8c
commit a5a9779cb9
9 changed files with 3226 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
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 leave(ctx: &Context, msg: &Message) -> CommandResult {
let guild_id = msg.guild_id.unwrap();
let manager = songbird::get(ctx)
.await
.expect("Client placed in at init.")
.clone();
let has_handler = manager.get(guild_id).is_some();
if has_handler {
if let Err(err) = manager.remove(guild_id).await {
check_msg(msg.channel_id.say(&ctx.http, format!("Failed: {:?}", err)).await);
}
check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await);
}
else {
check_msg(msg.reply(ctx, "Not in a voice channel").await);
}
Ok(())
}