ADVANCE

This is triggered when the dj booth advances to the next play. It passes a JSON object with a dj user object, the current media object, a score object, and, if there was something playing before the advance, the lastPlay object, which is a JSON object of the last played item.

USAGE

API.on(API.ADVANCE, callback);

JSON

{

    dj: <user Object>,

    media: <media Object>,

    score: {

        positive: <int>,

        negative: <int>,

        grabs: <int>

    },

    lastPlay: {

        dj: <user Object>,

        media: <media Object>,

        score: {

            positive: <int>,

            negative: <int>,

            grabs: <int>

        }

    }

}

Comments

  • Avatar
    xXSKHXx

    Um, Hi. Im currently trying to create a little bot for my community, I would like to know, how would I use this to have it display the current songs info after the previous one ends?

  • Avatar
    Colin

    @xXSKHXx On the Advance event:
    var media = API.getMedia();
    API.sendChat('Now playing: '+media.title+' — '+media.author);

  • Avatar
    Nawaxnawax

    Hello =) I'd like to know how I can use this event and the JSON object to show the song's score at the end of it, in the chat. Someone could tell me please ?
    I used API.getHistory() until now, but this is not working most of the time, and it shows the score of the wrong song.
    I'm sorry for my bad English.

  • Avatar
    xXSKHXx

    @Colin Thank you! I know its really late to say it, but I have already found out how to do this and have started making the bot into a more world-wideish kinda thing, ya with me so far?

    To see what I mean by world-wideish, this is the github link when I update the code:
    https://github.com/xXSKHXx/PlugDJBot/blob/master/PlugDJBot.js

  • Avatar
    DCV

    @Nawaxnawax ,
    Try using API.getScore() to do this. To get the woots, it's API.getScore().positive , mehs are API.getScore().negative and grabs are API.getScore().grabs . Here is a little code snippet for you, it sends the score of the song right when it finishes: http://pastebin.com/EX43WhwX
    Cheers,
    DCV

Powered by Zendesk