Boto/node/boto.js

51 lines
1.5 KiB
JavaScript

// B O T O
// ==================================
// TTV IRC BOT: Sariboto
// ==================================
// !COMMANDS
// ==================================
// TODO:
// ==================================
// + Add Cooldowns
// + Add Mod vs Streamer vs Viewer vs Sub control
// + Turn BOTO into join userchannel_db & make botoff to rm_userchannel_db
// + Timed
// + B-Day Calc
// +
// +
const tmi = require('tmi.js');
require('dotenv').config();
console.log(process.env.API_HOST);
const client = new tmi.Client({
options: { debug: true },
connection: {
secure: true,
reconnect: true
},
identity: {
username: process.env.TTV_BOT_USERNAME,
password: process.env.TTV_BOT_OAUTH
},
channels: [ process.env.TTV_CHANNELS ]
});
client.connect();
client.on('message', (channel, tags, message, self) => {
if(self) return;
const badges = tags.badges || {};
const isBroadcaster = badges.broadcaster;
const isMod = badges.moderator;
const isModUp = isBroadcaster || isMod;
const botUserState = client.userstate[channel];
const amMod = botUserState !== undefined && botUserState.mod === true;
if(isModUp && message.toLowerCase().startsWith('!so')) {
console.log('BLEEP! BLOOP! On behave of The Sarimoko Show, I'd like the thank my producers, my agents, & @${args.join(' ')} for making all of this possible! https://twitch.tv/${args.join(' ')}');
}
if(message.toLowerCase().startsWith('!mod')) {
console.log('LOG: Non-Mod command used!');
}
});