Monchoman45

Bleach wiki chatbot

Mar 25th, 2012
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. importScriptPage('MediaWiki:APIQuery.js', 'monchbox');
  2. importScriptPage('MediaWiki:B3.js/Chatbot.js', 'monchbox').onload = function() {
  3.     Torus.addListener('join', function(data) {
  4.         if(!Torus.chats[data.roomId].parent) {Torus.io.sendMessage(data.roomId, 'Hi, we have new chat rules. Please read [[Bleach Wiki:Chat Policy]]. You must have ten edits to be here.');}
  5.     });
  6.     setTimeout(function() {
  7.         if(!Chatbot.log[533].length) {return;}
  8.         var api = new APIQuery();
  9.         api.newQuery('POST', {action: 'edit', title: 'Project:Chat/' + Torus.commands.eval('chatbot today'), text: '<pre>' + Chatbot.log[533].join('\n') + '</pre>'}, function() {console.log('Log saved');});
  10.         api.send(0);
  11.     }, 60 * 60 * 1000);
  12. }
  13.  
  14. if(wgCanonicalSpecialPageName == 'Chat') {
  15.     mainRoom.model.chats.bind('afteradd', $.proxy(function(chat) {
  16.         if(chat.attributes.isInlineAlert && chat.attributes.text.indexOf(' has joined the chat.') != -1 && chat.attributes.text.indexOf(wgUserName) != 0) {
  17.             var chatEntry = new models.ChatEntry({roomId: this.roomId, name: wgUserName, text: 'Hi, we have new chat rules. Please read [[Bleach Wiki:Chat Policy]]. You must have ten edits to be here.'});
  18.             this.socket.send(chatEntry.xport());
  19.         }
  20.     }, mainRoom));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment