pub async fn now_playing(ctx: &Context, guild_id: SerenityGuildId) -> Result<CreateEmbed> {
    let manager = _get_songbird(ctx).await;
    if let Some(handler_lock) = manager.get(guild_id) {
        let handler = handler_lock.lock().await;
        // get track
        if let Some(track) = handler.queue().current() {
            let mut e = default_embed();
            // field with the name as a hyperlink to the source
            e.field("Now Playing:", _hyperlink_song(track.metadata()), false);
            // field with a nice formatted duration
            let track_time = _duration_format(track.metadata().duration);
            let duration_string = match track.get_info().await {
                Ok(info) => format!("{}/{}", _duration_format(Some(info.position)), track_time),
                Err(_) => track_time,
            };
            e.field("Duration:", duration_string, false);
            // thumbnail url if it exists
            if let Some(image) = &track.metadata().thumbnail {
                e.image(image);
            }
            drop(handler);
            return Ok(e);
        } else {
            drop(handler);
            return Err(NOTHING_PLAYING_ERROR.to_string());
        }
    } else {
        return Err(NOT_IN_VOICE_ERROR.to_string());
    }
}
///
/// basically sends a nice embed of the current playing song
///
basically sends a nice embed of the current playing song
basically sends a nice embed of the current playing song
pub async fn now_playing(ctx: &Context, guild_id: SerenityGuildId) -> Result<CreateEmbed> {
    let manager = _get_songbird(ctx).await;
    if let Some(handler_lock) = manager.get(guild_id) {
        let handler = handler_lock.lock().await;
        // get track
        if let Some(track) = handler.queue().current() {
            let mut e = default_embed();
            // field with the name as a hyperlink to the source
            e.field("Now Playing:", _hyperlink_song(track.metadata()), false);
            // field with a nice formatted duration
            let track_time = _duration_format(track.metadata().duration);
            let duration_string = match track.get_info().await {
                Ok(info) => format!("{}/{}", _duration_format(Some(info.position)), track_time),
                Err(_) => track_time,
            };
            e.field("Duration:", duration_string, false);
            // thumbnail url if it exists
            if let Some(image) = &track.metadata().thumbnail {
                e.image(image);
            }
            drop(handler);
            return Ok(e);
        } else {
            drop(handler);
            return Err(NOTHING_PLAYING_ERROR.to_string());
        }
    } else {
        return Err(NOT_IN_VOICE_ERROR.to_string());
    }
}
pub async fn now_playing ( ctx : & Context , guild_id : SerenityGuildId ) -> Result < CreateEmbed > { let manager = _get_songbird ( ctx ) . await ; if let Some ( handler_lock ) = manager . get ( guild_id ) { let handler = handler_lock . lock ( ) . await ; // get track if let Some ( track ) = handler . queue ( ) . current ( ) { let mut e = default_embed ( ) ; // field with the name as a hyperlink to the source e . field ( " " , _hyperlink_song ( track . metadata ( ) ) , false ) ; // field with a nice formatted duration let track_time = _duration_format ( track . metadata ( ) . duration ) ; let duration_string = match track . get_info ( ) . await { Ok ( info ) => format ! ( " " _duration_format ( Some ( info position ) ) track_time ) , Err ( _ ) => track_time , } ; e . field ( " " , duration_string , false ) ; // thumbnail url if it exists if let Some ( image ) = & track . metadata ( ) . thumbnail { e . image ( image ) ; } drop ( handler ) ; return Ok ( e ) ; } else { drop ( handler ) ; return Err ( NOTHING_PLAYING_ERROR . to_string ( ) ) ; } } else { return Err ( NOT_IN_VOICE_ERROR . to_string ( ) ) ; } }
basically sends a nice embed of the current playing song
basically sends a nice embed of the current playing song
ctx
&Context
guild_id
SerenityGuildId
ctx
&Context
guild_id
SerenityGuildId