Skip to content

Instantly share code, notes, and snippets.

@Juici
Last active February 19, 2017 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Juici/52f0f830339acfa7df64bd20a272273f to your computer and use it in GitHub Desktop.
Save Juici/52f0f830339acfa7df64bd20a272273f to your computer and use it in GitHub Desktop.
auto skip for plug.dj broken advance
(function (enabled) {
if (enabled)
return;
let needSkip;
function onNewMedia(evt) {
setTimeout(() => {
const timer = API.getMedia().duration;
const cid = API.getMedia().cid;
needSkip = true;
setTimeout(() => skipCheck(cid), timer * 1000);
}, 1000);
}
function skipCheck(cid) {
if (API.getMedia().cid !== cid)
return;
const rem = API.getTimeRemaining();
if (rem <= -1 && needSkip) {
needSkip = false;
API.moderateForceSkip();
API.sendChat('/me AutoSkip');
} else {
setTimeout(skipCheck, 1000);
}
}
API.on(API.ADVANCE, onNewMedia);
API.on(API.USER_SKIP, onNewMedia);
API.on(API.MOD_SKIP, onNewMedia);
window.autoskip = true;
})(window.autoskip);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment