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);
}
}
}
});