Skip to content

Instantly share code, notes, and snippets.

@Benzi
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save Benzi/bafa243cf09dbde2891d to your computer and use it in GitHub Desktop.

Select an option

Save Benzi/bafa243cf09dbde2891d to your computer and use it in GitHub Desktop.
Bans all current and incoming peasants in a plug.dj community
(function() {
var banning = false;
function killAPI() {
API.off(API.CHAT_COMMAND);
}
API.on(API.CHAT_COMMAND, function(command) {
if (command === "/banall") {
if (banning) {
banning = !banning;
return API.chatLog("Stopped banning.");
}
else {
banning = !banning;
return API.chatLog("Banning all peasants!");
}
}
if (command === "/kill") {
API.chatLog("BanScript Deactivated!");
killAPI();
}
});
function banPeasants() {
if (banning){
var users = API.getUsers();
for (var i = 0; i < users.length; i++) {
if (users[i].role < 1) {
API.moderateBanUser(users[i].id, 5, API.BAN.HOUR);
}
}
}
};
function trigger() {
setInterval(banPeasants, 100);
}
API.chatLog("BanScript Activated!");
trigger();
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment