AutoKick

// <syntaxhighlight lang="javascript">
if (chat.attributes.name !== mw.config.get('wgUserName')) {

```
       if (localStorage.getItem('disabled') !== 'disabled' && !isInlineAlert) {
           // spamming
           Robyn_Grayson.spam(n);
           // kick for swears
           if (new RegExp(SWEARS.join('|'), "mi").test(t) === true) {
               send(n + ', please don\'t swear.');
               Robyn_Grayson.kick(n)
           }
           // ban for slurs
           else if (new RegExp(SLURS.join('|'), "mi").test(t) === true) {
               send(n + ', please don\'t use that language.');
               mainRoom.socket.send(new models.BanCommand({
                   userToBan: n,
                   time: 86400,
                   reason: 'Slur'
               }).xport());
           } else if (t.match(/\n/) !== null) {
               if (t.match(/\n/g).length > 10) {
                   send(n + ', please don\'t flood.');
                   Robyn_Grayson.kick(n);
               }
           }
           // warn for caps
           /*else if (/\b[A-Z]{2,}\b/g.test(t)) {
               var exec = t.match(/\b[A-Z]{2,}\b/g);
               if (exec.length < 7) Robyn_Grayson.caps[n] = Robyn_Grayson.caps[n] === undefined ? exec.length : Robyn_Grayson.caps[n] + exec.length;
               if (exec.length > 15) {
                   send(n + ', please don\'t use more than 6 capital words.');
                   Robyn_Grayson.kick(n);
                   if (Robyn_Grayson.warned.indexOf(n) == -1) {
                       Robyn_Grayson.warned.push(n);
                       setTimeout(function() {
                           Robyn_Grayson.warned.splice(Robyn_Grayson.warned.indexOf(n), 1);
                       }, 1800000);
                   }
               } else if (Robyn_Grayson.caps[n] > 6 || exec.length > 6) {
                   send(n + ', please don\'t abuse caps.');
                   Robyn_Grayson.caps[n] = 0;
                   if (Robyn_Grayson.warned.indexOf(n) != -1)
                       Robyn_Grayson.kick(n);
                   else {
                       Robyn_Grayson.warned.push(n);
                       setTimeout(function() {
                           Robyn_Grayson.warned.splice(Robyn_Grayson.warned.indexOf(n), 1);
                       }, 1800000);
                   }
               }
               // warn for stretching text
           }*/
           else if (/(\w)\1{22,}/.test(t)) {
               send(n + ', please don\'t stretch text.');
           }
           // warn for big text
           else if (/\[big\](.+?)\[\/big\]/g.test(t)) {
                   send(n + ', please don\'t abuse big text.');
               }
           } else if (/\[big\](?!.*\[big\])(.*)/g.test(t)) {
                   send(n + ', please don\'t abuse big text.');
               }
           } else {
               if (Robyn_Grayson.caps[n]) Robyn_Grayson.caps[n]--;
           }
       }

```

Robyn\_Grayson.spam = function(usr) {

```
   if (Robyn_Grayson.spam[usr] === undefined) Robyn_Grayson.spam[usr] = 1;
   else Robyn_Grayson.spam[usr]++;
   if (Robyn_Grayson.spam[usr] > 7) {
       send(usr + ", please don't spam.");
       if (Robyn_Grayson.spam.wow[usr] === undefined) {
           Robyn_Grayson.kick(usr);
           Robyn_Grayson.spam.wow[usr] = 1;
       } else {
           Robyn_Grayson.impCmds.ban(wgUserName, usr + '|20 minutes|Repeatedly spamming.');
           Robyn_Grayson.spam.wow[usr] = undefined;
           setTimeout(function() {
               send('!mods See above.');
           }, 5000)
       }
       Robyn_Grayson.spam[usr] = 0;
       return;
   }
   setTimeout(function() {
       Robyn_Grayson.spam[usr]--;
   }, 7000);

```

};
Robyn\_Grayson.spam.wow = {};
Robyn\_Grayson.parseTime = function(secs) {

```
   secs = Number(secs);
   var toReturn = *;*
   if (isNaN(secs) || secs >= 31536000000) return 'infinity';
   var obj = {
       second: 1,
       minute: 60,
       hour: 3600,
       day: 86400,
       week: 604800,
       month: 2592000,
       year: 31536000
   };
   var arr = Object.keys(obj).sort(function(a, b) {
       return obj[b] - obj[a];
   });
   $.each(arr, function(i, val) {
       var d = obj[val];
       if (d <= secs) {
           var r = Math.floor(secs / d);
           secs -= r * d;
           toReturn += r + ' ' + val + (r != 1 ? 's ' : ' ');
       }
   });
   return toReturn.trim();

```

};

// Swears
var SWEARS = ["\\bd?a?fuc?ki?n?g?\\b", // fuck

```
       "\\bw+\\s*t+\\s*f+\\b", // WTF
       "\\bmotherfuck", "\\bsh[i!]t\\b", "\\bsh[i!]tt", "\\bsh[i!]tp", "\\bb[i!]tch", "\\bcunt", "\\bdafuq\\b", "\\bwhore\\b", "\\bmofo\\b", "\\bfml\\b", "\\bgtfo\\b", "\\bstfu\\b", "\\bidf[kc]\\b", "\\bidgaf\\b", "\\bidef[kc]\\b", "\\blmfao\\b", "\\bjfc\\b", "\\bomfg", "\\bomf\\b", "\\bffs\\b", "\\bmilf\\b"
   ],
   // Slurs
   SLURS = ["\\bnigg", "\\bniglet\\b", "\\bfag\\b", "\\bfagg"],
   weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

```

Robyn\_Grayson.impCmds = {

```
   enable: function(n, t, c) {
       if (localStorage.getItem('disabled') === 'enabled') {
           send('I already kick for swears.');
       } else {
           localStorage.setItem('disabled', 'enabled');
           send('Gonna kick for swears.');
       }
   },
   disable: function(n, t, c) {
       if (localStorage.getItem('disabled') === 'disabled') {
           send('I don\'t kick for swears.');
       } else {
           localStorage.setItem('disabled', 'disabled');
           send('I don\'t kick for swears now.');
       }
   },

```