View difference between Paste ID: J1DxBtWV and RTD54FGb
SHOW: | | - or go back to the newest paste.
1-
Models.history.load(); //history needs to be loaded so it doesn't return blank array
1+
Models.history.load();
2
3-
API.addEventListener(API.DJ_UPDATE, repeatcheck); //activates when there's a new DJ
3+
API.addEventListener(API.DJ_UPDATE, repeatcheck);
4
5
function repeatcheck(user) {
6-
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
6+
7
for(var j=1; j<50;j++) {
8-
if (Models.history.data[j].media.cid == Models.room.data.media.cid) { //if the ID of the current song is the same as the ID of an item in history
8+
9-
API.sendChat("j"); //just test code, if it works, will replace with code to skip and send message
9+
if (Models.history.data[j].media.cid == Models.room.data.media.cid) {
10
API.moderateForceSkip();
11
API.sendChat("Sorry, that song's still in history");
12
}
13
14
}
15
16
}