use serenity;

use super::super::prelude::*;

use serenity::prelude::*;
use serenity::{
    framework::standard::{macros::command, Args, CommandResult},
    model::channel::Message,
};

#[command]
fn skip(ctx: &mut Context, msg: &Message, _: Args) -> CommandResult {
    if let Err(err) = channel_contains_author(ctx, msg) {
        msg.channel_id.say(&ctx.http, err)?;
        return Ok(());
    }

    let mut data = ctx.data.write();

    if let Some(media) = data.get_mut::<Media>() {
        let mut media_lock = media.lock().unwrap();

        MediaData::next_song(ctx, &mut media_lock, msg)?;
    }

    Ok(())
}
