Boto/node/boto.js

428 lines
16 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:04:46 +00:00
if(isModUp) {
//
}
2022-02-11 08:03:21 +00:00
// !COMMAND START
2022-02-10 02:54:44 +00:00
// ==================================
2022-02-09 06:55:26 +00:00
client.on('message', (channel, tags, message, self) => {
if(self || !message.startsWith('!')) return;
2022-02-11 08:03:21 +00:00
// !COMMAND => command
// ----------------------------------
2022-02-09 06:55:26 +00:00
const args = message.slice(1).split(' ');
const command = args.shift().toLowerCase();
2022-02-11 08:03:21 +00:00
// Checks if bot has mod permissions in channel
// ----------------------------------
2022-02-09 06:55:26 +00:00
const botUserState = client.userstate[channel];
const amMod = botUserState !== undefined && botUserState.mod === true;
2022-02-10 01:38:27 +00:00
2022-02-11 08:04:46 +00:00
2022-02-10 02:08:32 +00:00
// M O D S Q U A D
// ----------------------------------
2022-02-10 02:16:19 +00:00
//let isMod = user.mod || user['user-type'] === 'mod';
//let isBroadcaster = channel.slice(1) === user.username;
//let isModUp = isMod || isBroadcaster;
2022-02-11 07:47:26 +00:00
//if(isModUp) {
// if(command === 'mod') {
// client.say(channel, `Mod test command`);
// }
// if else(command === 'mods') {
// client.say(channel, `Mod test command`);
// }
// else {
2022-02-11 07:46:12 +00:00
// NULL
2022-02-11 07:47:26 +00:00
// }
//}
2022-02-10 02:08:32 +00:00
// I N F O
2022-02-10 00:33:41 +00:00
// ==================================
2022-02-10 02:08:32 +00:00
// The Cord
// ----------------------------------
2022-02-11 07:38:32 +00:00
if(command === 'cord' ||
command === 'discord') {
2022-02-10 02:57:26 +00:00
client.say(channel, `/me The Cord by Sarimoko is joinable & sharable at: https://cord.sarimoko.com/`);
2022-02-10 02:08:32 +00:00
}
2022-02-10 06:16:49 +00:00
// The Template
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'template' ||
command === 'example') {
2022-02-10 06:16:49 +00:00
client.say(channel, `/me @${tags.username} says ${args.join(' ')} BLEEP! BLOOP!`);
2022-02-10 06:06:28 +00:00
}
// The Boto
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'boto' ||
command === 'sariboto' ||
command === 'sari-boto') {
2022-02-10 01:38:27 +00:00
client.say(channel, `/me Bleep! Bloop! Twitch IRC connected... LETS PARTY!!!`);
2022-02-09 06:55:26 +00:00
client.say(channel, `!kappagen imGlitch EarthDay imGlitch EarthDay imGlitch`);
}
2022-02-10 02:08:32 +00:00
// The Color
// ----------------------------------
else if(command === 'color') {
client.say(channel, `/color ${args.join(' ')}`);
2022-02-10 06:06:28 +00:00
client.say(channel, `/me Bleep! Bloop! New color is ${args.join(' ')}`);
}
// The Dojo
// ----------------------------------
else if(command === 'dojo') {
client.say(channel, `/me Learn the methods of a madman at: https://dojo.sarimoko.com/`);
2022-02-10 02:08:32 +00:00
}
2022-02-10 00:33:41 +00:00
// The Echo
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 00:33:41 +00:00
else if(command === 'echo') {
2022-02-10 02:08:32 +00:00
client.say(channel, `/me @${tags.username} says ${args.join(' ')}`);
2022-02-10 00:07:38 +00:00
}
2022-02-10 02:54:44 +00:00
// The Hair
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'hair' ||
command === 'hairflip' ||
command === 'bang' ||
command === 'headbang') {
2022-02-10 02:54:44 +00:00
client.say(channel, `!kappagen sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR `);
}
2022-02-10 06:06:28 +00:00
// The Hugs
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'hug' ||
command === 'hugs') {
2022-02-10 06:06:28 +00:00
client.say(channel, `/me @${tags.username} just gave ${args.join(' ')} a big'o'hug! `);
}
// The Kick
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'kick' ||
command === 'attack' ||
command === 'punch') {
2022-02-10 06:06:28 +00:00
client.say(channel, `/me @${tags.username} just hit ${args.join(' ')}! I'm telling! `);
}
2022-02-10 02:54:44 +00:00
// The Lurk
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'lurk' ||
command === 'lurking' ||
command === 'lurkin' ||
command === 'brb') {
2022-02-11 07:17:40 +00:00
client.say(channel, `/me Enjoy your lurk ${tags.username}, thanks for the viewership! GL out there ${args.join(' ')}`);
2022-02-10 02:54:44 +00:00
client.say(channel, `!kappagen sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO `);
}
// The Mote
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'mote' ||
command === 'emote' ||
command === 'emotes') {
2022-02-10 02:54:44 +00:00
client.say(channel, `!kappagen sarimoBOTO sarimoDEAD sarimoDUDE sarimoGAME sarimoMASK sarimoGEAR sarimoHAIR sarimoHYPE sarimoLURK sarimoMILK sarimoNERD sarimoRAID sarimoSALT sarimoSOUP sarimoRIDE sarimoKO `);
client.say(channel, `sarimoBANG sarimoFREEDOM sarimoLURKbrb sarimoSALTplz sarimoTRIP `);
}
2022-02-10 06:06:28 +00:00
// The Sale
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'sale' ||
command === 'buygames' ||
command === 'humble' ||
command === 'bundle' ||
command === 'humblebundle') {
2022-02-10 06:06:28 +00:00
client.say(channel, `Get sales & give to charity! Win + win, right?! Check out HumbleBundle, use this affiliated link to support the stream: https://www.humblebundle.com/?partner=rusttv`);
}
2022-02-11 07:17:40 +00:00
// The Time
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'time' ||
command === 'pst' ||
command === 'pac') {
2022-02-11 07:17:40 +00:00
client.say(channel, `BLEEP! BLOOP! PST | 2-Pac Standard Time`);
}
2022-02-11 07:38:32 +00:00
// The trip
// ----------------------------------
else if(command === 'trip' ||
command === 'trippin' ||
command === 'tripping') {
client.say(channel, `BLEEP! BLOOP! I'm trippin dragon ballz! Did @trip_228 spike my bios?!`);
client.say(channel, `!kappagen sarimoTRIP sarimoTRIP sarimoTRIP`);
client.say(channel, `Stay calm... Just remember your name & ip address... @Sarimoko 127.0.0.1... @Sarimoko 127.0.0.1...`);
}
2022-02-10 02:54:44 +00:00
// The Wish
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'wish' ||
command === 'wishlist' ||
command === 'amazon' ||
command === 'gift') {
2022-02-10 02:57:26 +00:00
client.say(channel, `/me First off, thank you ${tags.username} for even considering contributing directly! Amazon Wishlists have been split into sub-categories and are available at: https://wish.sarimoko.com/ `);
2022-02-10 02:54:44 +00:00
}
2022-02-10 06:24:43 +00:00
// K A P P A
// ==================================
// FX | Bad Game
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'badgame' ||
command === 'antigg' ||
command === 'notgg') {
2022-02-10 06:24:43 +00:00
client.say(channel, `!kappagen sarimoDEAD sarimoGAME `);
}
// FX | Hi
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'hi' ||
command === 'hello' ||
command === 'welcome' ||
command === 'greeting' ||
command === 'greetings') {
2022-02-10 06:24:43 +00:00
client.say(channel, `!kappagen HeyGuys bleedPurple HeyGuys bleedPurple HeyGuys`);
client.say(channel, `/me Hi Hello Howdy Hola こんにちは Oi 你好 여보세요 Здравствуйте Bonjour Hej Hiya Heyo Yo`);
}
// FX | Clap
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'clap' ||
command === 'claps' ||
command === 'applaude') {
2022-02-10 06:24:43 +00:00
client.say(channel, `!kappagen :clap: FBCatch :clap: FBCatch :clap: `);
}
// FX | Sup
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'sup' ||
command === 'whatsup' ||
command === 'sups' ||
command === 'wazzup' ||
command === 'soup' ||
command === 'soups') {
2022-02-10 06:24:43 +00:00
client.say(channel, `!kappagen sarimoTRIP sarimoSOUP sarimoTRIP sarimoSOUP sarimoTRIP sarimoSOUP `);
client.say(channel, `/me Yo @${tags.username}, how goes it?`);
}
// FX | Salt
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'salt' ||
command === 'yoho' ||
command === 'rage' ||
command === 'rip' ||
command === 'sassy' ||
command === 'salty' ||
command === 'bitter') {
2022-02-10 06:24:43 +00:00
client.say(channel, `!kappagen PJSalt PanicVis PJSalt WutFace PJSalt PunOko PJSalt BabyRage PJSalt`);
}
// G E N E R A L
// ==================================
// Uptime
// ----------------------------------
// if(commandName === 'uptime') {
// let timestamp = new Date(body.stream.created_at).getTime();
// uptime = countdown(timestamp, Date.now(), 158);
// reply(uptime);
//}
// The 2Pac Timezone
// ----------------------------------
//else if(command === '2pac' || command === 'pst' || command === 'timezone') {
// client.say(channel, `/me Off in the distance @${tags.username} screams...`);
// client.say(channel, `" ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} ${args.join(' ')} " can be heard to all those around!`);
//}
// Backend
// ----------------------------------
//else if(command === 'ad' || command === 'ads' || command === 'dab30' || command === 'intermission') {
// client.say(channel, `Bleep! Bloop! Sub to bypass ads! `);
// client.commercial("channel", 30)
// .then((data) => {
// // data returns [channel, seconds]
// }).catch((err) => {
// //
// });
//}
2022-02-10 06:39:06 +00:00
// T H E V I E W E R S
// ==================================
// TODO Followerage
// TODO Total Followers
// TODO Total Channel Views
// TODO Current Viewers
// ----------------------------------
2022-02-10 06:24:43 +00:00
2022-02-10 06:39:06 +00:00
// T H E R A I D
// ==================================
// Being Raided
// ----------------------------------
//else if(command === 'raid' || command === 'raided') {
// client.say(channel, `!kappagen sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM`);
// client.say(channel, `/me Did @${tags.username} say RAID!?! I believe ${args.join(' ')}, was mentioned as well!`);
//}
// Raiding Someone
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'raid' ||
command === 'raidcall' ||
command === 'spam' ||
command === 'spamwars') {
2022-02-10 06:39:06 +00:00
client.say(channel, `!kappagen sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM`);
client.say(channel, `/me Thanks everyone for watching!!! PREPARE TO SPAM!`);
client.say(channel, `/me Copy'n'Paste the following: (Yes, even if you don't have a sub... We know your a sub at PrideHeartL PrideHeartR LuvHearts`);
client.say(channel, `sarimoRAID sarimoFREEDOM You may take us viewers, but you'll NEVER take our FREEDOM!`);
}
// Shoutout
// ----------------------------------
2022-02-11 07:38:32 +00:00
else if(command === 'so' ||
command === 'shoutout') {
2022-02-11 07:17:40 +00:00
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-10 06:39:06 +00:00
}
2022-02-10 06:24:43 +00:00
2022-02-10 06:23:25 +00:00
// S T R E A M E L E M E N T S
2022-02-10 06:22:06 +00:00
// ==================================
2022-02-10 06:23:25 +00:00
else if(command === 'accountage') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'bet') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'chatstats') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'commands') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
// Sub only
2022-02-10 06:23:25 +00:00
else if(command === 'editcounter') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'enter') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'followage') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'kappagen') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'leaderboard') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
// Sub only
2022-02-10 06:23:25 +00:00
else if(command === 'permit') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'points') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'quote') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'rename') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
2022-02-10 06:23:25 +00:00
else if(command === 'setgame') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
2022-02-10 06:23:25 +00:00
else if(command === 'setpoints') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
2022-02-10 06:23:25 +00:00
else if(command === 'settitle') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'top') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'uptime') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 06:23:25 +00:00
else if(command === 'watchtime') {
2022-02-10 06:22:06 +00:00
// SE handles it so nothing here to prevent throwing an ERROR
}
2022-02-10 00:33:41 +00:00
// E R R O R S
// ==================================
2022-02-09 06:55:26 +00:00
// NOT FOUND FUNCTION
else {
2022-02-10 01:43:52 +00:00
client.say(channel, `/me Bleep! Bloop! Error! Sorry, @${tags.username} hopefully SE/SL/Nitebot has ya covered...`);
2022-02-09 06:55:26 +00:00
}
});
2022-02-11 08:03:21 +00:00
// !COMMAND END
// ==================================
// TTV Re-Active
// ==================================
client.on("anongiftpaidupgrade", (channel, username, userstate) => {
client.whisper(username, `BLEEP! BLOOP! Anon-Sub upgraded!!!`);
});
client.on("ban", (channel, username, reason, userstate) => {
client.say(channel, `/me BYE FELICIA!!!`);
client.say(channel, `!kappagen BOP BOP BOP `);
});
client.on("cheer", (channel, userstate, message) => {
client.say(channel, `/me BLEEP! BLOOP! O'SNAP! Bit hype!!! sarimoBANG`);
client.say(channel, `!kappagen sarimoHYPE sarimoBITS`);
});
client.on("clearchat", (channel) => {
client.say(channel, `Chat Rule Reminder`);
client.say(channel, `/me 1. Do NOT feed the Trolls!`);
client.say(channel, `/me 2. Do NOT be a Troll!`);
client.say(channel, `/me 3. #NSFQ in cord.sarimoko.com ONLY!`);
client.say(channel, `/me 4. Do NOT be another brick in the wall!`);
});
client.on("giftpaidupgrade", (channel, username, sender, userstate) => {
// Huh? Tier 1 => Tier2
});
client.on("hosting", (channel, target, viewers) => {
client.say(channel, `/me BLEEP! BLOOP! @Sarimoko got hosted! Do something entertaining!`);
});
// ***ANNOYING*** User IRC Connect/Disconnect
client.on("join", (channel, username, self) => {
// client.say(channel, `/me +1 Chatter! Viewer or Bot...? Time will tell!`);
});
client.on("part", (channel, username, self) => {
// client.say(channel, `/me -1 Chatter! Where's my bounty hunters? Essemble the *air-qoutes* search-party *air-qoutes*`);
});
client.on("raided", (channel, username, viewers) => {
client.say(channel, `/me Welcome raiders!!! We may take your viewership, but we'll never take your FREEDOM!!!`);
client.say(channel, `!kappagen sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM`);
});
client.on("subgift", (channel, username, streakMonths, recipient, methods, userstate) => {
let senderCount = ~~userstate["msg-param-sender-count"];
client.say(channel, `/me Thank you for supporting The Sarimoko Show with Gift-Subs!`);
});
client.on("submysterygift", (channel, username, numbOfSubs, methods, userstate) => {
let senderCount = ~~userstate["msg-param-sender-count"];
client.say(channel, `/me BLEEP! BLOOP! Am I getting hacked? Anon just Gift-Subbed! If I get erased... I love you all!`);
});
client.on("resub", function (channel, username, months, message, userstate, methods) {
client.say(channel, `/me BLEEP! BLOOP! Thanks for the Re-Sub! We're just 2 lost souls, swimming in a fish bowl, sub after sub...`);
});
client.on("subscription", function (channel, username, method, message, userstate) {
client.say(channel, `/me BLEEP! BLOOP! New subscriber! Spam your new emotes!!! Let's see you're fav!`);
client.say(channel, `!kappagen sarimoKO sarimoNERD`);
});
client.on("whisper", (from, userstate, message, self) => {
if (self) return;
client.say(channel, `/me Bleep! Bloop! Sariboto's Inbox (+1): SEXT Message Recieved!`);
});