SHARE
TWEET

SlendyBot.js

a guest Apr 18th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * @name        RPWChatBot.js
  3.  * @description Browser-based chatbot JS, certain sections are modified from ChatLogger
  4.  * @author Messenger of Heaven
  5.  */
  6.  
  7. // Imports
  8. window.logInterval = 900000;
  9. if (wgCityId == '1534124') {
  10. importArticles({
  11.     type: 'script',
  12.     articles: [
  13.         'u:dev:ChatLogger.js',
  14.         'u:dev:Chat-js.js'
  15.     ]
  16. });
  17. // Word filters
  18.  var words = ['slut'],
  19.     mainRoom;
  20. mw.hook('dev.chat').add(function (chat) {
  21.     if (wgCityId != '1534124') return;
  22.     mainRoom.socket.bind('chat:add', function(msg) {
  23.         var send = function(m) {
  24.             mainRoom.socket.send(new models.ChatEntry({
  25.             roomId: this.roomId,
  26.             name: mw.config.get('wgUserName'),
  27.             text: String(m)
  28.             }).xport());
  29.         };
  30.         var data = JSON.parse(msg.data).attrs,
  31.         user = mainRoom.model.users.findByName(data.name),
  32.         since = user.attributes.since[0] * 1000 || Date.now();
  33.         if (new RegExp(words.join('|').toUpperCase(), 'm').test(data.text) && Date.now() - since < 1000 * 60 * 60 * 24 * 30) {
  34.             mainRoom.socket.send(JSON.stringify({
  35.                 attrs: {
  36.                     msgType: 'command',
  37.                     command: 'ban',
  38.                     userToBan: data.name,
  39.                     time: 86400,
  40.                     reason: 'Automatically banned for misbehaving in chat.'
  41.                 }
  42.             }));
  43.         }
  44. // Chat commands
  45.             break;
  46.             case 'ping': (function(){
  47.             message.reply('pong!');
  48.             })();
  49.             break;
  50.             case 'mew': (function(){
  51.             message.reply('MEW MEW MEW MEW!');
  52.             })();
  53.             break;
  54.             case 'ship' : (function(){
  55.                 var toShip = text.split(' | ');
  56.                 if (!text || !toShip[0] || !toShip[1]){
  57.                     send('Usage: %ship CHOICE A | CHOICE B');
  58.                     return;
  59.                 }
  60.                 message.channel.send('(h)Loly. Ship name: ' + toShip[0].slice(Math.round(toShip[0].length / 2)).charAt(0).toUpperCase() + toShip[0].slice(Math.round(toShip.length / 2)).slice(1) + toShip[1].slice(Math.round(toShip.length / 2)));
  61.             })();
  62.             break;
  63.             case "rate": (function() {
  64.                 message.reply(' I\'d give ' + text + ' a ' + Math.floor(Math.random() * 11) + '/10.');
  65.             break;
  66.             case 'botinfo': (function(){
  67.                 message.reply('Hello! I\'m SlendyBot I was created May 14th 2017 by Messenger of Heaven on The Demon\'s Light wiki. If you have any questions about my code message my creator here: [[Message_Wall:Messenger of Heaven|Messenger of Heaven]] or [[Message_Wall:TheKorraFanatic|TheKorraFanatic]]');
  68.             })();
  69.             break;
  70.             case "choose" : (function() {
  71.                 if (!text) {
  72.                     message.channel.send('Usage: !choose CHOICE A | CHOICE B | Etc...');
  73.                     return;
  74.                 }
  75.                 var choice = text.split("|")
  76.                 var ac = Math.floor(Math.random() * choice.length);
  77.                 if (choice[1] === choice[2]) {
  78.                     message.channel.send('Error: You have not specified a second choice.');
  79.                     return;
  80.                 }
  81.                 message.channel.send('I choose ' + choice[ac] + '!');
  82.             })();  
  83.             break;
  84.             case 'bite': (function(){
  85.                 var arr = ['https://media.giphy.com/media/OWabwoEn7ezug/giphy.gif, https://media.giphy.com/media/69159EHgBoG08/giphy.gif'];
  86.                 const user = message.mentions.users.first();
  87.                 const embed = new Discord.RichEmbed()
  88.                 .setDescription('**' + message.guild.member(user.id).user.username + '**,  has been bitten by **' + message.member.user.username + '** :joy_cat:.')
  89.                 .setColor('#e22dee')
  90.                 .setImage(arr[Math.floor(Math.random() * arr.length)]);
  91.                 message.channel.send(embed);
  92.             })();
  93.             break;
  94.         }
  95.     }
  96.     if (/\bgrrr\b/i.test(message.content) && message.member.id != bot.user.id) {
  97.         message.reply('Grrrrrrrrrrrr');
  98.     }
  99.     if (/\breee\b/i.test(message.content) && message.member.id != bot.user.id) {
  100.         message.reply('REEEEEEEEE');
  101.     }
  102.     if (/\bmew\b/i.test(message.content) && message.member.id != bot.user.id) {
  103.         message.reply('mew mew mew MEOW');
  104.     }
  105.     if (/\bkitty squad\b/i.test(message.content) && message.member.id != bot.user.id) {
  106.         message.reply('Kitty Squad Best Squad');
  107.     }
  108.     if (/\bhot\b/i.test(message.content) && message.member.id !=bot.user.id) {
  109.         message.reply('The only hot thing in the world is me, sweetheart')
  110.     }
  111.     if (/\bBTS\b/i.test(message.content) && message.member.id !=bot.user.id) {
  112.         message.reply('BTS = Band That Sucks :stuck_out_tongue: ')
  113.     }        
  114.         }
  115.     });
  116. });
  117. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top