loop plus fixes

This commit is contained in:
2024-02-08 22:57:59 +01:00
parent 70c249787c
commit 4a0184811e
10 changed files with 174 additions and 14 deletions

View File

@@ -0,0 +1,40 @@
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 pause(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 handler = handler_lock.lock().await;
let queue = handler.queue();
let _ = queue.pause();
check_msg(
msg.channel_id
.say(
&ctx.http,
format!("Song paused."),
)
.await,
);
} else {
check_msg(
msg.channel_id
.say(&ctx.http, "Not in a voice channel to play in")
.await,
);
}
Ok(())
}