Advertisement
Guest User

ban nubs

a guest
Nov 17th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var min_level = 2;
  2. var whitelist = [];
  3. $.getJSON('/all_online_users', function(users) {
  4.     $.each(users, function(idx, usr) {
  5.         if ((usr.tag === 'initiate') && (usr.level < min_level)){
  6.             whitelist.push(usr.username);
  7.         }
  8.     })
  9. });
  10. console.log(whitelist);
  11.  
  12. function banhammer() {
  13.     window.setInterval(function() {
  14.         $.getJSON('/all_online_users', function(users) {
  15.             $.each(users, function(idx, usr) {
  16.                 if ((usr.tag === 'initiate') && (usr.level < min_level) && ($.inArray(usr.username, whitelist) == -1)){
  17.                     console.log('Banning ' + usr.username);
  18.                                         whitelist.push(usr.username);
  19.                     $.post('/ban_ip', {'username': usr.username, 'comment': 'spam'});
  20.                 };
  21.             })
  22.         })
  23.     }, 4000)
  24. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement