Skip to content

Instantly share code, notes, and snippets.

@elwayman02
Created February 20, 2015 06:25
Show Gist options
  • Save elwayman02/6d304d424cda273d345a to your computer and use it in GitHub Desktop.
Save elwayman02/6d304d424cda273d345a to your computer and use it in GitHub Desktop.
p3 fail
onWaitListUpdate: function() {
// If autojoin is not enabled, don't try to disable
if (!Settings.autojoin) return;
// If user is DJing, don't try to disable
var dj = API.getDJ();
if (dj !== null && dj.id === API.getUser().id) return;
// If user is in waitlist, don't try to disable
if (API.getWaitListPosition() > -1) return;
// If waitlist is full, don't try to disable
if (API.getWaitList().length == 50) return;
// If user was last DJ (DJ Cycle Disabled)
if (this.lastDJ == API.getUser().id) return;
// Disable
Settings.autojoin = false;
Menu.setEnabled('join', Settings.autojoin);
},
@elwayman02
Copy link
Author

the logic basically goes like this:

  • if autojoin disabled, do nothing
  • if user is DJing, do nothing
  • if user is in waitlist, do nothing
  • if waitlist is full, do nothing
  • if user just DJed the last song, do nothing
  • if all of the above scenarios are false, disable autojoin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment