Boto/node/boto.js

52 lines
1.6 KiB
JavaScript
Raw Normal View History

2022-02-11 08:03:21 +00:00
// 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
// +
// +
2022-02-09 06:55:26 +00:00
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;
2022-02-11 08:15:56 +00:00
const botUserState = client.userstate[channel];
const amMod = botUserState !== undefined && botUserState.mod === true;
2022-02-11 08:19:27 +00:00
if(isModUp && message.toLowerCase().startsWith('!so')) {
2022-02-11 08:21:54 +00:00
console.log('MOD COMMAND | so | shoutout');
client.say(channel, `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(' ')}`);
2022-02-11 08:15:56 +00:00
}
if(message.toLowerCase().startsWith('!mod')) {
console.log('LOG: Non-Mod command used!');
}
2022-02-09 06:55:26 +00:00
});