Last active
February 19, 2017 16:19
-
-
Save Juici/52f0f830339acfa7df64bd20a272273f to your computer and use it in GitHub Desktop.
auto skip for plug.dj broken advance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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