Block2Block

Untitled

Dec 22nd, 2016
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. registerPlugin({
  2.     name: 'Mineplex Moderation',
  3.     version: '1.0',
  4.     description: 'This is for moderating the Mineplex Teamspeak',
  5.     author: 'Block2Block',
  6.     vars: {
  7.         blacklisted: {
  8.             title: 'Comma-separated list of blacklisted words',
  9.             type: 'string'
  10.         },
  11.         whitelisted: {
  12.             title: 'Comma-separated list of whitelisted websites',
  13.             type: 'string'
  14.         }
  15.     }
  16. }, function(sinusbot, config, info) {
  17.     var blacklist = config.blacklisted.split(',').map(function(e) { return e.trim() });
  18.     var whitelist = config.whitelisted.split(',').map(function(e) { return e.trim() });
  19.     var inappropriateName = 0;
  20.     var inappropriateChannelName = 0;
  21.     var warnInappropriateName = 0;
  22.     var warnInappropriateChannelName = 0;
  23.     var kickVulgarity = 0;
  24.     var name;
  25.     var clientId;
  26.     var channelId;
  27.    
  28.     function checkName(clientId,name){
  29.         for (i in blacklist){
  30.             if (name.toLowerCase().indexOf(blacklist[i]) >= 0){
  31.                 banByClientId(clientId, 43200, "Inappropriate Nickname [Bot Moderation] [Warned]")
  32.                 sinusbot.log("[Mineplex Moderation] " + name + " has been banned for an inappropriate nickname.");
  33.                 inappropriateName++;
  34.                 return;
  35.             } else{
  36.                 return;
  37.             }
  38.         }
  39.     };
  40.    
  41.     function checkChannelName(channelId,name){
  42.         for (i in blacklist){
  43.             if (name.toLowerCase().indexOf(blacklist[i]) >= 0) {
  44.                 for (var i=0;i<=channelId.clients.length;i++){
  45.                     privateChat(channelId.clients[i], "The channel you were in was deleted because it has an inappropriate name.");
  46.                     kickChannel(channelId.clients[i], "Inappropriate Channel Name [Bot Moderation]");
  47.                 }
  48.                 sinusbot.log("[MP Bot Moderation] Channel " + name + " has been deleted as it's name is inappropriate.")
  49.                 inappropriateChannelName++;
  50.                 channelDelete(channelId);
  51.                 return;
  52.             } else {
  53.                 return;
  54.             }
  55.         }
  56.     }
  57.    
  58.     //Inappropriate Nicknames
  59.     sinusbot.on('nick', function(ev){
  60.         for (i in blacklist){
  61.             if (ev.client.nick.toLowerCase().indexOf(blacklist[i]) >= 0){
  62.                 poke(ev.clientId, "[b]WARNING:[/b] Please change your nickname to something appropriate or you will be banned!");
  63.                 sinusbot.log("[Mineplex Moderation] " + name + " has been warned for an inappropriate nickname.");
  64.                 warnInappropriateName++;
  65.                 setTimeout(function() { checkName(ev.clientId, ev.client.nick.toLowerCase());}, 60000);
  66.                 break;
  67.             } else {
  68.                 return;
  69.             }
  70.         }
  71.     });
  72.     sinusbot.on('clientMove', function(ev){
  73.         for (i in blacklist){
  74.             if (ev.client.nick.toLowerCase().indexOf(blacklist[i]) >= 0){
  75.                 poke(ev.clientId, "[b]WARNING:[/b] Please change your nickname to something appropriate or you will be banned!");
  76.                 sinusbot.log("[Mineplex Moderation] " + name + " has been warned for an inappropriate nickname.");
  77.                 warnInappropriateName++;
  78.                 setTimeout(function() { checkName(ev.clientId, ev.client.nick.toLowerCase());}, 60000);
  79.                 break;
  80.             } else {
  81.                 return;
  82.             }
  83.         }
  84.     });
  85.  
  86.     //Inappropriate Channel Names
  87.     sinusbot.on('channelCreate', function(ev){
  88.         for (i in blacklist) {
  89.             if (ev.name.toLowerCase().indexOf(blacklist[i]) >= 0){
  90.                     poke(ev.clientId, "[b]WARNING:[/b]Please change your channel name to something appropriate or the channel will be deleted!");
  91.                     log("[Mineplex Moderation] People in the channel " + ev.channel.name + " have been warned for an inappropriate nickname.");
  92.                     warnInappropriateChannelName++;
  93.                     setTimeout(function() { checkChannelName(ev.channel, ev.channel.name.toLowerCase());}, 60000);
  94.                     break;
  95.             }
  96.         }
  97.     });
  98.     sinusbot.on('channelUpdate', function(ev){
  99.         for (i in blacklist) {
  100.             if (ev.name.toLowerCase().indexOf(blacklist[i]) >= 0){
  101.                 for (var i=0;i<=ev.channel.clients.length;i++) {
  102.                     poke(ev.channel.clients[i], "[b]WARNING:[/b]Please change your channel name to something appropriate or the channel will be deleted!");
  103.                 }
  104.                 log("[Mineplex Moderation] People in the channel " + ev.channel.name + " have been warned for an inappropriate channel name.");
  105.                 warnInappropriateChannelName++;
  106.                 setTimeout(function() { checkChannelName(ev.channel, ev.channel.name.toLowerCase()); }, 60000);
  107.                 break;
  108.             }
  109.         }
  110.     });
  111.    
  112.     //Chat Moderation
  113.     sinusbot.on('channelChat', function(ev){
  114.  
  115.        
  116.     });
  117.     sinusbot.on('chat', function(ev){
  118.  
  119.        
  120.     });
  121. });
Advertisement
Add Comment
Please, Sign In to add comment