mcicoria / jqbx-bot-plugins

JQBX Bot Plugins
66 stars 27 forks source link

New tracks only mode #24

Open maniexx opened 6 years ago

maniexx commented 6 years ago

Since the bot already has /first information, and the ability to skip (as in the meme commands), it could enforce only playing tracks which haven't been played in the room (or in any room) before. That would obviously need to be a mod-only feature, probably with some automatic expiry, so nobody leaves it on by accident.

I'm submitting an issue, and not a PR, because I don't know how to access the /first data, or skip tracks.

mcicoria commented 6 years ago

For the track history:

that.bot.emit("do:getTrackHistory", trackUri); // like spotify:track:xxx
that.bot.on("trackHistory", function( tracks, uri ){
    // tracks = [ {uri, userUri, username, etc}, {}]; 
});

that.bot.emit("do:getTrackHistoryByArtists", [ {uri: "spotify:artist:xxxx", ...}, { ... } ]); // like track.artists
that.bot.on("trackHistoryByArtist", function(tracks, uri, artist) {

}); 

And to skip:

that.bot.emit("do:skip", that.data.room.djs[0], that.bot.room.id);  // skip current dj

If you want to move the skipped DJ back up to the front of the queue you can do so with:

that.bot.emit("do:moveDJToPosition", that.data.room.djs[that.data.room.djs.length-1], 1);

Let me know if all that makes any sense, or if you need more info.