Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. const tmi = require('tmi.js');
  2. // Define configuration options
  3. // const opts = {
  4. // identity: {
  5. // username: 'demonzz1',
  6. // password: 'oauth:myn40im2rlw8p1uob9uvy3y8qvswir'
  7. // },
  8. // channels: [
  9. // 'demonzz1'
  10. // ]
  11. // };
  12.  
  13. const opts = {
  14. identity: {
  15. username: 'witam_sie_z_kazdym_bot',
  16. password: 'oauth:helkleqxxzddz95mrkhpwdluw0n8l6'
  17. },
  18. channels: [
  19. 'demonzz1'
  20. ]
  21. };
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28. // Create a client with our options
  29. const client = new tmi.client(opts);
  30.  
  31. let helloNumber = 1;
  32.  
  33. let doPrzywitania = ['demonzz1'];
  34.  
  35. let zostaliPrzywitani = ['pajalockk'];
  36.  
  37. let i = 0;
  38. let j = 0;
  39. // Register our event handlers (defined below)
  40. client.on('message', onMessageHandler);
  41. client.on('connected', onConnectedHandler);
  42.  
  43.  
  44.  
  45. // Connect to Twitch:
  46. client.connect();
  47. // Called every time a message comes in
  48. function onMessageHandler(target, user, msg, self) {
  49. if (self) { return; } // Ignore messages from the bot
  50.  
  51. if (/*(function () {
  52. for (j = 0; j <= zostaliPrzywitani.length; j++) {
  53. if (user['display-name'] == zostaliPrzywitani[j]) {
  54. return false;
  55. }
  56. else {
  57. return true;
  58. }
  59. }
  60. }*/ (user['display-name'].indexOf(doPrzywitania) == -1) && (user['display-name'].indexOf(zostaliPrzywitani) == -1)) {
  61. doPrzywitania.push(user['display-name']);
  62.  
  63. }
  64. console.log(`DO PRZYWITANIA ${doPrzywitania}`);
  65. console.log(`ZOSTALI PRZYWITANI: ${zostaliPrzywitani}`);
  66. console.log(user['display-name']);
  67.  
  68. console.log(user['display-name'].indexOf(zostaliPrzywitani));
  69. console.log(user['display-name'].indexOf(doPrzywitania));
  70. }
  71.  
  72. setInterval(() => {
  73. if (/*doPrzywitania[i] != undefined && function () {
  74. for (j = 0; j <= zostaliPrzywitani.length; j++) {
  75. if (doPrzywitania[i] == zostaliPrzywitani[j]) {
  76. return fals SIEMA MURZYNIE TriHard
  77. }
  78. }
  79. } &&*/ (doPrzywitania[i].indexOf(zostaliPrzywitani) == -1)) {
  80. helloNumber = Math.floor((Math.random() * 10) + 1);
  81. switch (helloNumber) {
  82. case 1:
  83. client.action('demonzz1', `@${doPrzywitania[i]} Siema SIEMA MURZYNIE TriHard`);
  84.  
  85. break;
  86. case 2:
  87. client.action('demonzz1', `@${doPrzywitania[i]} Hejo SIEMA MURZYNIE TriHard`);
  88.  
  89. break;
  90. case 3:
  91. client.action('demonzz1', `@${doPrzywitania[i]} Siem SIEMA MURZYNIE TriHard`);
  92.  
  93. break;
  94. case 4:
  95. client.action('demonzz1', `@${doPrzywitania[i]} Hej SIEMA MURZYNIE TriHard`);
  96.  
  97. break;
  98. case 5:
  99. client.action('demonzz1', `@${doPrzywitania[i]} elo SIEMA MURZYNIE TriHard`);
  100.  
  101. break;
  102. case 6:
  103. client.action('demonzz1', `@${doPrzywitania[i]} cześć SIEMA MURZYNIE TriHard`);
  104.  
  105. break;
  106. case 7:
  107. client.action('demonzz1', `@${doPrzywitania[i]} SIEMA MURZYNIE TriHard`);
  108.  
  109. break;
  110. case 8:
  111. client.action('demonzz1', `@${doPrzywitania[i]} dzień dobry SIEMA MURZYNIE TriHard`);
  112.  
  113. break;
  114. case 9:
  115.  
  116. client.action('demonzz1', `@${doPrzywitania[i]} co SIEMA MURZYNIE TriHard`);
  117. break;
  118. default:
  119. client.action('demonzz1', `@${doPrzywitania[i]} co SIEMA MURZYNIE TriHard`);
  120.  
  121. }
  122. zostaliPrzywitani.push(doPrzywitania[i]);
  123. i++;
  124.  
  125.  
  126. }
  127. console.log(`Do doPrzywitaniaa zostało: ${doPrzywitania.length - zostaliPrzywitani.length}`);
  128. console.log(`LISTA PRZYWITANYCH ${zostaliPrzywitani}`);
  129. console.log(`LISTA DO PRZYWITANIA ${doPrzywitania}`);
  130. }, 5000);
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. // Called every time the bot connects to Twitch chat
  139. function onConnectedHandler(addr, port) {
  140. console.log(`* Connected to ${addr}:${port}`);
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement