Advertisement
Guest User

Untitled

a guest
Apr 5th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const tmi = require("tmi.js");
  2.  
  3.  
  4. var readline = require('readline');
  5. var rl = readline.createInterface({
  6.   input: process.stdin,
  7.   output: process.stdout,
  8.   terminal: false
  9. });
  10.  
  11. rl.on('line', function(line){
  12.     console.log(line);
  13. })
  14.  
  15.  
  16. const options = {
  17.     options: {
  18.         debug: false // true
  19.     },
  20.     connection: {
  21.         //cluster: 'aws',
  22.         reconnect: true,
  23.         secure: true
  24.     },
  25.     identity: {
  26.         username: "klay4_bot",
  27.         password: "oauth:sggooe8seugazuqjlp363vbu81h0mz"
  28.     },
  29.     channels: [ "klay4_" ]
  30. };
  31.  
  32.  
  33. const client = new tmi.client(options);
  34.  
  35.  
  36. // Invocazione funzioni
  37. client.on('join', benvenuto);
  38. client.on('chat', text_to_speach);
  39. client.on('chat', info);
  40.  
  41.  
  42. // Il bot si connette a Twitch
  43. client.connect();
  44.  
  45.  
  46.  
  47.  
  48.  
  49. function benvenuto (channel, username, message, self) {
  50.  
  51.     if (self) return;
  52.    
  53.     client.color("Red");
  54.    
  55.     if (username !== "klay4_bot") {
  56.         client.action('klay4_', "Benvenuto " + username);
  57.     }
  58. }
  59.  
  60.  
  61. function text_to_speach (channel, userstate, message, self) {
  62.  
  63.     if (userstate.mod == true) {
  64.         console.log("[MOD] " + userstate["display-name"] + " ha detto " + message);
  65.     }
  66.     else
  67.     {
  68.         console.log(userstate["display-name"] + " ha detto " + message);
  69.     }
  70.  
  71. }
  72.  
  73.  
  74. function info (channel, userstate, message, self) {
  75.    
  76.     if (self) return;
  77.  
  78.     if (message === "!steam") {
  79.         client.action('klay4_', "https://steamcommunity.com/id/Klay4_/");
  80.     }
  81.     else if (message === "!twitch") {
  82.         client.action('klay4_', "https://www.twitch.tv/klay4_");
  83.     }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement