Nurutomo2

Dad Bot [BOT] for OWOP

Mar 22nd, 2018
1,101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. OWOP.chat.send("/nick Dad Bot[BOT]");
  2. OWOP.chat.recvModifier = function(msg) {
  3.     if (chatType(msg) == "nickuser") {
  4.         nick = msg.substr((msg.indexOf("]") + 2),(msg.indexOf(": ") - 7));
  5.     } else {
  6.         nick = "ID " + getChatId(msg);
  7.     }
  8.     m = getRealChat(msg);
  9.     if (m.toLowerCase().split(' ')[0] == "im") {
  10.         fm = m.toLowerCase();
  11.         m = m.substr(fm.indexOf('im') + 3,m.length);
  12.         fm = m.toLowerCase();
  13.         if (fm == "dad") {
  14.             OWOP.chat.send("No you're not, you're " + nick);
  15.         } else {
  16.             OWOP.chat.send("Hi " + m + ", I'm Dad");
  17.         }
  18.     }
  19.     if (m.toLowerCase().split(' ')[0] == "i'm") {
  20.         fm = m.toLowerCase();
  21.         m = m.substr(fm.indexOf("i'm") + 4,m.length);
  22.         fm = m.toLowerCase();
  23.         if (fm == "dad") {
  24.             OWOP.chat.send("No you're not, you're " + nick);
  25.         } else {
  26.             OWOP.chat.send("Hi " + m + ", I'm Dad");
  27.         }
  28.     }
  29.     console.log(m);
  30.     return msg;
  31. }
  32.  
  33. function getRealChat(message) {
  34.     var nickname = message.split(": ")[0] + ": ";
  35.     var text = message.slice(nickname.length);
  36.     var idIndex = text.indexOf(': ');
  37.     var ntext = text.substr(0, idIndex);
  38.     return ntext.replace(/\d+/g, '') + text.slice(idIndex + 1);
  39. }
  40.  
  41. function chatType(text) {
  42.     text = text.toString();
  43.     if (text.startsWith("[D]")) {
  44.         return "discord";
  45.     } else if (text.startsWith("Server]") || text.startsWith("Server:") || text.startsWith("Nickname set to") || text.startsWith("User: ")) {
  46.         return "server";
  47.     } else if (text.startsWith("->")) {
  48.         return "tell";
  49.     } else if (text.startsWith("(M)")) {
  50.         return "moderator";
  51.     } else if (isNaN(text.split(": ")[0]) && text.split(": ")[0].charAt(0) != "[") {
  52.         return "admin";
  53.     } else if (text.split(": ")[0].charAt(0) == "[") {
  54.         return "nickuser";
  55.     } else {
  56.         return "nonick";
  57.     }
  58. }
  59.  
  60. function getChatId(m) {
  61.     if (chatType(m) == "nickuser") {
  62.         return m.substr(1,m.indexOf("]") - 1);
  63.     } else {
  64.         if (chatType(m) == "nonick") {
  65.             return m.substr(0,m.indexOf(": "));
  66.         } else {
  67.             return undefined;
  68.         }
  69.     }
  70. }
  71. // By Nurutomo #6541
Advertisement
Add Comment
Please, Sign In to add comment