viewing paste Unknown #26529 | 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
var tmi = require('tmi.js');
 
var options = {
    options: {
        debug: true
    },
    connection: {
        cluster: "aws",
        reconnect: true
    },
    identity: {
        username: "MinuetteBOT",
        password: ""
    },
    channels: ["hanjarolol"]
};
 
var client = new tmi.client(options);
client.connect();
 
client.on('connected', function(address, port){
    console.log("Address: " , address + "Port: " + port);
    client.action("thederpysupport", "has connected.");
});
 
client.on('chat', function(channel, user, message, self){
    if(message === "!test"){
        client.whisper(user['display-name'], "This is a test message.");
    }
    if(message === "!minuette"){
        client.say("thederpysupport", "I am a Twitch Chat Bot.");
    }
    if(message === "!discord"){
        if(user["user-type"] === "mod" || user["user-type"] === "caster" || user.username === channel.replace("#", "")){
        client.say("thederpysupport", "You can join the Derpy Gaming Network discord by clicking this link: https://discord.gg/0nCaX7zRQ4pOgcXI")};
    }
    if(message === "!stop"){
        if (user['display-name'] === "TheDerpySupport"){
            client.action(channels, "has disconnected.");
            client.disconnect();
        } else { client.say("thederpysupport", "Sorry " + user['display-name'] + " only Derpy can shut me down.");}
    }
});
Viewed 748 times, submitted by Guest.