Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const tmi = require('tmi.js');
- // Define configuration options
- // const opts = {
- // identity: {
- // username: 'demonzz1',
- // password: 'oauth:myn40im2rlw8p1uob9uvy3y8qvswir'
- // },
- // channels: [
- // 'demonzz1'
- // ]
- // };
- const opts = {
- identity: {
- username: 'witam_sie_z_kazdym_bot',
- password: 'oauth:helkleqxxzddz95mrkhpwdluw0n8l6'
- },
- channels: [
- 'demonzz1'
- ]
- };
- // Create a client with our options
- const client = new tmi.client(opts);
- let helloNumber = 1;
- let doPrzywitania = ['demonzz1'];
- let zostaliPrzywitani = ['pajalockk'];
- let i = 0;
- let j = 0;
- // Register our event handlers (defined below)
- client.on('message', onMessageHandler);
- client.on('connected', onConnectedHandler);
- // Connect to Twitch:
- client.connect();
- // Called every time a message comes in
- function onMessageHandler(target, user, msg, self) {
- if (self) { return; } // Ignore messages from the bot
- if (/*(function () {
- for (j = 0; j <= zostaliPrzywitani.length; j++) {
- if (user['display-name'] == zostaliPrzywitani[j]) {
- return false;
- }
- else {
- return true;
- }
- }
- }*/ (user['display-name'].indexOf(doPrzywitania) == -1) && (user['display-name'].indexOf(zostaliPrzywitani) == -1)) {
- doPrzywitania.push(user['display-name']);
- }
- console.log(`DO PRZYWITANIA ${doPrzywitania}`);
- console.log(`ZOSTALI PRZYWITANI: ${zostaliPrzywitani}`);
- console.log(user['display-name']);
- console.log(user['display-name'].indexOf(zostaliPrzywitani));
- console.log(user['display-name'].indexOf(doPrzywitania));
- }
- setInterval(() => {
- if (/*doPrzywitania[i] != undefined && function () {
- for (j = 0; j <= zostaliPrzywitani.length; j++) {
- if (doPrzywitania[i] == zostaliPrzywitani[j]) {
- return fals SIEMA MURZYNIE TriHard
- }
- }
- } &&*/ (doPrzywitania[i].indexOf(zostaliPrzywitani) == -1)) {
- helloNumber = Math.floor((Math.random() * 10) + 1);
- switch (helloNumber) {
- case 1:
- client.action('demonzz1', `@${doPrzywitania[i]} Siema SIEMA MURZYNIE TriHard`);
- break;
- case 2:
- client.action('demonzz1', `@${doPrzywitania[i]} Hejo SIEMA MURZYNIE TriHard`);
- break;
- case 3:
- client.action('demonzz1', `@${doPrzywitania[i]} Siem SIEMA MURZYNIE TriHard`);
- break;
- case 4:
- client.action('demonzz1', `@${doPrzywitania[i]} Hej SIEMA MURZYNIE TriHard`);
- break;
- case 5:
- client.action('demonzz1', `@${doPrzywitania[i]} elo SIEMA MURZYNIE TriHard`);
- break;
- case 6:
- client.action('demonzz1', `@${doPrzywitania[i]} cześć SIEMA MURZYNIE TriHard`);
- break;
- case 7:
- client.action('demonzz1', `@${doPrzywitania[i]} SIEMA MURZYNIE TriHard`);
- break;
- case 8:
- client.action('demonzz1', `@${doPrzywitania[i]} dzień dobry SIEMA MURZYNIE TriHard`);
- break;
- case 9:
- client.action('demonzz1', `@${doPrzywitania[i]} co SIEMA MURZYNIE TriHard`);
- break;
- default:
- client.action('demonzz1', `@${doPrzywitania[i]} co SIEMA MURZYNIE TriHard`);
- }
- zostaliPrzywitani.push(doPrzywitania[i]);
- i++;
- }
- console.log(`Do doPrzywitaniaa zostało: ${doPrzywitania.length - zostaliPrzywitani.length}`);
- console.log(`LISTA PRZYWITANYCH ${zostaliPrzywitani}`);
- console.log(`LISTA DO PRZYWITANIA ${doPrzywitania}`);
- }, 5000);
- // Called every time the bot connects to Twitch chat
- function onConnectedHandler(addr, port) {
- console.log(`* Connected to ${addr}:${port}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement