viewing paste Unknown #29224 | Javascript

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
var tmi = require('tmi.js');
 
var options = {
    options: {
        debug: true
    },
    connection: {
        cluster: "aws",
        reconnect: true
    },
    identity: {
        username: "MinuetteBOT",
        password: "oauth:"
    },
    channels: ["thederpysupport"]
};
 
var client = new tmi.client(options);
client.connect();
 
client.on('connected', function(address, port){
    console.log("Address: " , address + "Port: " + port);
});
 
client.on('join', function(channel, username){
    if (username.toUpperCase() === "MINUETTEBOT"){
        client.action(channel, "has connected.");
    }
});
 
var load = require('./commands.js');
 
client.on('chat', function(channel, user, message, self){
console.log(channel);
console.log(user);
console.log(message);
for(i=0;i<load.botCommands.length;i++) { 
    if(message.toLowerCase() === "!"+load.botCommands[i].command){
        if(load.botCommands[i].mod) {
            if(!(user["user-type"] === "mod" || user.username === channel.replace("#", ""))) {
                break;
            }
        }
        if(load.botCommands[i].me) {
            if(user['display-name'] != "TheDerpySupport"){
                break;
            }
        }
        if(load.botCommands[i].whisper) {
            client.whisper(user['display-name'], load.botCommands[i].description);
        } else {
            client.say(channel, load.botCommands[i].description);
        }
    }
}
});
Viewed 912 times, submitted by Guest.