mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 12:26:10 +01:00
0.2.0 player update
This commit is contained in:
@@ -3,10 +3,38 @@ use serenity::framework::standard::CommandResult;
|
||||
use serenity::model::prelude::*;
|
||||
use serenity::prelude::*;
|
||||
|
||||
// use crate::commands::misc::check_msg;
|
||||
use crate::commands::misc::check_msg;
|
||||
|
||||
#[command]
|
||||
#[only_in(guilds)]
|
||||
async fn skip(_ctx: &Context, _msg: &Message) -> CommandResult {
|
||||
async fn skip(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.skip();
|
||||
|
||||
check_msg(
|
||||
msg.channel_id
|
||||
.say(
|
||||
&ctx.http,
|
||||
format!("Song skipped: {} in queue.", queue.len()),
|
||||
)
|
||||
.await,
|
||||
);
|
||||
} else {
|
||||
check_msg(
|
||||
msg.channel_id
|
||||
.say(&ctx.http, "Not in a voice channel to play in")
|
||||
.await,
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user