View difference between Paste ID: h6gW9AZV and NepTfgg6
SHOW: | | - or go back to the newest paste.
1-
Models.history.load();
1+
Models.history.load(); //history needs to be loaded so it doesn't return blank array
2
3-
API.addEventListener(API.DJ_UPDATE, repeatcheck);
3+
API.addEventListener(API.DJ_UPDATE, repeatcheck); //activates when there's a new DJ
4
5
function repeatcheck(user) {
6-
var historylist=Models.history.data;
6+
var historylist=Models.history.data; //gets array of songs in history
7-
var currentID=Models.room.data.media.cid;
7+
var currentID=Models.room.data.media.cid; //gets ID of current song
8
9-
for(var j=1; j<50;j++) {
9+
for(var j=1; j<50;j++) { //should technically start at 0, but 1st item in history may be current song, don't want to check that
10
11
if (historylist[j].media.cid == currentID) {
12-
API.sendChat(j);
12+
API.sendChat(j); //just test code, if it works, will replace with code to skip and send message
13
}
14
15
}
16
17
}