Advertisement
Guest User

RubiBotV2

a guest
Jan 3rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const tmi = require('tmi.js');
  2.  
  3. // Define configuration options
  4. const opts = {
  5.   connection: {
  6.         cluster: "aws",
  7.         reconnect: true
  8.   },
  9.   identity: {
  10.     username: "kfeevollautomat",
  11.     password: "oauth:1w9d02r6oy2wc0lf83mmhxc1zcdg0t",
  12.   },
  13.   channels: ["rubizockt"]
  14. };
  15.  
  16. // Create a client with our options
  17. const client = new tmi.Client(opts);
  18.  
  19. // Register our event handlers (defined below)
  20. //Special User - Special Greetings after join
  21. client.on('join', function(channel, username, self) {
  22.    
  23.     if (username === "rubishelfer") {
  24.     client.say("rubizockt", "Helferlein, was willst du denn hier?")};
  25.     if (username === "rubizockt") {
  26.     client.say("rubizockt", "Schön, dass der Streamer auch da ist")};
  27.     if (username === "izzer_") {
  28.     client.say("rubizockt", "Da izzer_ ja Kappa")};
  29.     if (username === "deadlynightling") {
  30.     client.say("rubizockt", "Da schleicht ein Deadly rum, Hallo =)")};
  31.     if (username === "themavkis") {
  32.     client.say("rubizockt", "Da ist 1 Mavis - ich freu mich :) ")};
  33.     if (username === "dotex97x") {
  34.     client.say("rubizockt", "Dot.exe wird ausgeführt - Sei Gegrüßt WholeWheat")};
  35.     if (username === "fraeulein_jumpcut") {
  36.     client.say("rubizockt", "Begrüßen Sie die Schwester. Hallo Fräulein Jumpcut. Kappa")};
  37.     if (username === "daemonic_medusa") {
  38.     client.say("rubizockt", "Hello to the Netherlands. Welcome Medusa! ")};
  39.     if (username === "ptk_panthers") {
  40.     client.say("rubizockt", "Na Panther, alles fresh? ")};
  41.     if (username === "migsy_") {
  42.     client.say("rubizockt", "Hola Migsy_, muy buenas, como estas mi amor?")};
  43. });
  44. client.on('message', onMessageHandler);
  45. client.on('connected', onConnectedHandler);
  46.  
  47. // Connect to Twitch:
  48. client.connect();
  49.  
  50. // Called every time a message comes in
  51. function onMessageHandler (target, context, msg, self) {
  52.  
  53.  
  54.   if (self) { return; } // Ignore messages from the bot
  55.  
  56.   // Remove whitespace from chat message
  57.   const commandName = msg.trim();
  58.  
  59.   // If the command is known, let's execute it
  60.   if (commandName === '!dice') {
  61.     const num = rollDice();
  62.     client.say(target, `Du hast eine ${num} gewürfelt`);
  63.     console.log(`* Executed ${commandName} command`);
  64.   }
  65.   if (commandName === '!kaffee') {
  66.      client.say(target, `Ist unterwegs!`);
  67.      console.log(`* Executed ${commandName} command`);
  68.   }
  69.   if (commandName === 'rubizoCof') {
  70.      client.say(target, `Ich glaube er braucht einen neuen Kaffee ^^`);
  71.      console.log(`* Executed ${commandName} command`);
  72.   }
  73.   if (commandName === '!dampf') {
  74.      client.say(target, `Dampf ablassen ist bloss ein Kosewort für's Rauchen am offenen Fenster. Nix für eure Augen und Ohren Kappa`);
  75.      console.log(`* Executed ${commandName} command`);
  76.  }
  77.  if (commandName === '!teamspeak') {
  78.      client.say(target, `Teamspeak? Ham wa: 87.106.147.176:9990 Und dann ab in den Raum RubiZockt!! Kappa`);
  79.      console.log(`* Executed ${commandName} command`);
  80. }
  81. var patt = new RegExp("Hund");      // Suchwort : Hund
  82. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  83.  
  84. if (res == true) {                  // true erfüllt also ab an die Kommandos
  85.     client.say(target, `Wuff!! Pogdog`);    // << Wuff! in den Chat ;)
  86. }
  87. var patt = new RegExp("Katze");     // Suchwort : Katze
  88. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  89.  
  90. if (res == true) {                  // true erfüllt also ab an die Kommandos
  91.     client.say(target, `Miau!! CoolCat`);   // << Wuff! in den Chat ;)
  92. }
  93. var patt = new RegExp("mitspielen");        // Suchwort : mitspielen
  94. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  95.  
  96. if (res == true) {                  // true erfüllt also ab an die Kommandos
  97.     client.say(target, `Ich glaub er sagt Bescheid, wenn er jemanden braucht  TwitchLit TwitchUnity`);  // << Antwort ;)
  98. }
  99. var patt = new RegExp("Krake");     // Suchwort : Krake
  100. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  101.  
  102. if (res == true) {                  // true erfüllt also ab an die Kommandos
  103.     client.say(target, ` Squid1 Squid2 Squid3 Squid4`);     // << Antwort ;)
  104. }
  105. var patt = new RegExp("xD");        // Suchwort : Krake
  106. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  107.  
  108. if (res == true) {                  // true erfüllt also ab an die Kommandos
  109.     client.say(target, ` xD ist so 90er Digga PixelBob `);  // << Antwort ;)
  110. }
  111. var patt = new RegExp("Fortnite");      // Suchwort : mitspielen
  112. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  113.  
  114. if (res == true) {                  // true erfüllt also ab an die Kommandos
  115.     client.say(target, `Fort-WAS? Bist du des Wahnsinns?  SoonerLater NotLikeThis KappaPride Ich glaub das ist nicht dein Stream hier ... Schade Kappa`);   // << Antwort ;)
  116. }
  117. var patt = new RegExp("knorke");        // Suchwort : mitspielen
  118. var res = patt.test(commandName); // <<durchsucht commandName(twitch-chat-nachricht) &  liefert bei Treffer true zurück
  119.  
  120. if (res == true) {                  // true erfüllt also ab an die Kommandos
  121.     client.say(target, `Hat er gerade ernsthaft "knorke" benutzt? FailFish FailFish FailFish`);     // << Antwort ;)
  122. }
  123. }
  124.  
  125.  
  126. // Function called when the "dice" command is issued
  127. function rollDice () {
  128.  const sides = 6;
  129.  return Math.floor(Math.random() * sides) + 1;
  130. }
  131.  
  132. // Called every time the bot connects to Twitch chat
  133. function onConnectedHandler (addr, port) {
  134.  console.log(`* Connected to ${addr}:${port}`);
  135.  client.say("rubizockt", `Hallo Zusammen DendiFace`);
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement