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-10 02:54:44 +00:00
// R E A C T I V E
// ==================================
2022-02-10 03:41:13 +00:00
client . on ( "anongiftpaidupgrade" , ( channel , username , userstate ) => {
// Do your stuff.
2022-02-10 04:06:14 +00:00
client . whisper ( username , ` UPGRADE COMPLETE! Thank you very much for supporting The Sarimoko Show! ` ) ;
2022-02-10 03:41:13 +00:00
} ) ;
client . on ( "ban" , ( channel , username , reason , userstate ) => {
// Do your stuff.
client . say ( channel , ` /me bye felicia ` ) ;
} ) ;
client . on ( "cheer" , ( channel , userstate , message ) => {
// Do your stuff.
client . say ( channel , ` /me Cheer test ` ) ;
} ) ;
client . on ( "clearchat" , ( channel ) => {
// Do your stuff.
client . say ( channel , ` The Laws ` ) ;
2022-02-10 06:06:28 +00:00
client . say ( channel , ` The Rule of Law ` ) ;
2022-02-10 03:41:13 +00:00
client . say ( channel , ` 1. Don't feed the Trolls! ` ) ;
} ) ;
client . on ( "giftpaidupgrade" , ( channel , username , sender , userstate ) => {
// Do your stuff.
} ) ;
client . on ( "hosting" , ( channel , target , viewers ) => {
// Do your stuff.
client . say ( channel , ` /me Host Test ` ) ;
} ) ;
2022-02-10 06:06:28 +00:00
// User joins/connects
2022-02-10 04:22:51 +00:00
client . on ( "join" , ( channel , username , self ) => {
2022-02-10 06:06:28 +00:00
client . say ( channel , ` /me +1 Chatter! Viewer or Bot...? Time will tell! ` ) ;
2022-02-10 04:22:51 +00:00
} ) ;
2022-02-10 06:06:28 +00:00
// Bye Felicia!
2022-02-10 03:41:13 +00:00
client . on ( "part" , ( channel , username , self ) => {
2022-02-10 06:06:28 +00:00
client . say ( channel , ` /me -1 Chatter! Where's my bounty hunters? Essemble the *air-qoutes* search-party *air-qoutes* ` ) ;
2022-02-10 03:41:13 +00:00
} ) ;
2022-02-10 06:06:28 +00:00
// Incoming Raid
2022-02-10 03:41:13 +00:00
client . on ( "raided" , ( channel , username , viewers ) => {
2022-02-10 06:06:28 +00:00
client . say ( channel , ` /me Welcome raiders!!! We make take your viewership, but we'll never take your FREEDOM!!! ` ) ;
2022-02-10 03:41:13 +00:00
client . say ( channel , ` !kappagen sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM ` ) ;
} ) ;
client . on ( "subgift" , ( channel , username , streakMonths , recipient , methods , userstate ) => {
// Do your stuff.
let senderCount = ~ ~ userstate [ "msg-param-sender-count" ] ;
} ) ;
client . on ( "submysterygift" , ( channel , username , numbOfSubs , methods , userstate ) => {
// Do your stuff.
let senderCount = ~ ~ userstate [ "msg-param-sender-count" ] ;
} ) ;
2022-02-10 02:54:44 +00:00
client . on ( "resub" , function ( channel , username , months , message , userstate , methods ) {
// Do your stuff.
2022-02-10 03:41:13 +00:00
client . say ( channel , ` /me Re-SUB test ` ) ;
2022-02-10 02:54:44 +00:00
} ) ;
client . on ( "subscription" , function ( channel , username , method , message , userstate ) {
// Do your stuff.
2022-02-10 03:41:13 +00:00
client . say ( channel , ` /me SUB Test ` ) ;
} ) ;
client . on ( "whisper" , ( from , userstate , message , self ) => {
// Don't listen to my own messages..
if ( self ) return ;
// Do your stuff.
client . say ( channel , ` /me Bleep! Bloop! Sext message recieved! ` ) ;
2022-02-10 02:54:44 +00:00
} ) ;
2022-02-10 01:38:27 +00:00
2022-02-10 02:54:44 +00:00
// !COMMANDS
// ==================================
2022-02-10 01:24:35 +00:00
// TODO:
2022-02-10 02:54:44 +00:00
// ==================================
2022-02-10 01:24:35 +00:00
// + Add Cooldowns
// + Add Mod vs Streamer vs Viewer vs Sub control
// + Turn BOTO into join userchannel_db & make botoff to rm_userchannel_db
2022-02-10 01:38:27 +00:00
// + Timed
// + B-Day Calc
// +
// +
2022-02-09 06:55:26 +00:00
client . on ( 'message' , ( channel , tags , message , self ) => {
if ( self || ! message . startsWith ( '!' ) ) return ;
const args = message . slice ( 1 ) . split ( ' ' ) ;
const command = args . shift ( ) . toLowerCase ( ) ;
const botUserState = client . userstate [ channel ] ;
const amMod = botUserState !== undefined && botUserState . mod === true ;
2022-02-10 01:38:27 +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;
//if(isModUp) {
2022-02-10 02:08:32 +00:00
// Something for moderators or higher
2022-02-10 02:16:19 +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
// ----------------------------------
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-09 06:55:26 +00:00
// The Boto
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 06:06:28 +00:00
else if ( command === 'boto' || command === 'sariboto' || command === 'sari-boto' ) {
client . say ( channel , ` /me Bleep! Bloop! sarimoBOTO Twitch IRC connected... LETS PARTY!!! ` ) ;
client . say ( channel , ` !kappagen imGlitch EarthDay imGlitch EarthDay imGlitch ` ) ;
}
// The Boto
// ----------------------------------
2022-02-10 02:08: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
// ----------------------------------
else if ( command === 'hair' || command === 'hairflip' || command === 'bang' || command === 'headbang' ) {
client . say ( channel , ` !kappagen sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR ` ) ;
}
2022-02-10 06:06:28 +00:00
// The Hugs
// ----------------------------------
else if ( command === 'hug' || command === 'hugs' ) {
client . say ( channel , ` /me @ ${ tags . username } just gave ${ args . join ( ' ' ) } a big'o'hug! ` ) ;
}
// The Kick
// ----------------------------------
else if ( command === 'kick' || command === 'attack' || command === 'punch' ) {
client . say ( channel , ` /me @ ${ tags . username } just hit ${ args . join ( ' ' ) } ! I'm telling! ` ) ;
}
2022-02-10 02:54:44 +00:00
// The Lurk
// ----------------------------------
else if ( command === 'lurk' || command === 'lurking' || command === 'lurkin' || command === 'brb' ) {
client . say ( channel , ` /me Enjoy your lurk ${ tags . username } , thanks for the viewership! ` ) ;
client . say ( channel , ` !kappagen sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO ` ) ;
}
// The Mote
// ----------------------------------
else if ( command === 'mote' || command === 'emote' || command === 'emotes' ) {
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
// ----------------------------------
else if ( command === 'sale' || command === 'buygames' || command === 'humble' || command === 'bundle' || command === 'humblebundle' ) {
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-10 02:54:44 +00:00
// The Wish
// ----------------------------------
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
}
// 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 00:07:38 +00:00
2022-02-10 02:54:44 +00:00
// T H E R A I D
2022-02-10 00:33:41 +00:00
// ==================================
// Being Raided
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 04:06:14 +00:00
//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!`);
//}
2022-02-10 00:33:41 +00:00
// Raiding Someone
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 04:06:14 +00:00
else if ( command === 'raid' || command === 'raidcall' || command === 'spam' || command === 'spamwars' ) {
2022-02-10 01:12:49 +00:00
client . say ( channel , ` !kappagen sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM sarimoRAID sarimoFREEDOM ` ) ;
client . say ( channel , ` /me Thanks everyone for watching!!! PREPARE TO SPAM! ` ) ;
2022-02-10 06:06:28 +00:00
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 ` ) ;
2022-02-10 01:12:49 +00:00
client . say ( channel , ` sarimoRAID sarimoFREEDOM You may take us viewers, but you'll NEVER take our FREEDOM! ` ) ;
2022-02-10 00:33:41 +00:00
}
2022-02-10 06:06:28 +00:00
// Shoutout
// ----------------------------------
else if ( command === 'so' || command === 'shoutout' || command === 'holla' || command === 'pimp' ) {
client . say ( channel , ` Go checkout @ ${ tags . username } 's channel! Hit that follow button like it owes you money! ` ) ;
}
2022-02-10 00:33:41 +00:00
// K A P P A
// ==================================
2022-02-10 06:06:28 +00:00
// FX | Bad Game
// ----------------------------------
else if ( command === 'badgame' || command === 'anti-gg' || command === 'notgg' ) {
client . say ( channel , ` !kappagen sarimoDEAD sarimoGAME ` ) ;
}
2022-02-10 00:07:38 +00:00
// FX | Hi
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 01:38:27 +00:00
else if ( command === 'hi' || command === 'hello' || command === 'welcome' || command === 'greeting' || command === 'greetings' ) {
2022-02-10 00:07:38 +00:00
client . say ( channel , ` !kappagen HeyGuys bleedPurple HeyGuys bleedPurple HeyGuys ` ) ;
2022-02-10 01:12:49 +00:00
client . say ( channel , ` /me Hi Hello Howdy Hola こんにちは Oi 你好 여보세요 Здравствуйте Bonjour Hej Hiya Heyo Yo ` ) ;
}
2022-02-10 06:06:28 +00:00
// FX | Clap
// ----------------------------------
else if ( command === 'clap' || command === 'clap' || command === 'applaude' ) {
client . say ( channel , ` !kappagen :clap: FBCatch :clap: FBCatch :clap: ` ) ;
}
// FX | Sup
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 01:38:27 +00:00
else if ( command === 'sup' || command === 'whatsup' || command === 'sups' || command === 'wazzup' || command === 'soup' || command === 'soups' ) {
2022-02-10 01:12:49 +00:00
client . say ( channel , ` !kappagen sarimoTRIP sarimoSOUP sarimoTRIP sarimoSOUP sarimoTRIP sarimoSOUP ` ) ;
client . say ( channel , ` /me Yo @ ${ tags . username } , how goes it? ` ) ;
2022-02-10 00:07:38 +00:00
}
2022-02-10 00:33:41 +00:00
// FX | Salt
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 01:38:27 +00:00
else if ( command === 'salt' || command === 'yoho' || command === 'rage' || command === 'rip' || command === 'sassy' || command === 'salty' || command === 'bitter' ) {
2022-02-10 00:33:41 +00:00
client . say ( channel , ` !kappagen PJSalt PanicVis PJSalt WutFace PJSalt PunOko PJSalt BabyRage PJSalt ` ) ;
}
// G E N E R A L
// ==================================
// Uptime
2022-02-10 01:24:35 +00:00
// ----------------------------------
// if(commandName === 'uptime') {
// let timestamp = new Date(body.stream.created_at).getTime();
// uptime = countdown(timestamp, Date.now(), 158);
// reply(uptime);
//}
2022-02-10 00:33:41 +00:00
// The 2Pac Timezone
2022-02-10 01:24:35 +00:00
// ----------------------------------
2022-02-10 02:08:32 +00:00
//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!`);
//}
2022-02-10 04:33:36 +00:00
// Backend
// ----------------------------------
2022-02-10 06:06:28 +00:00
//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) => {
// //
// });
}
// S T R E A M E L E M E N T S
// ==================================
else if ( command === 'accountage' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'bet' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'chatstats' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'commands' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
// Sub only
else if ( command === 'editcounter' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'enter' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'followage' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'kappagen' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'leaderboard' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
// Sub only
else if ( command === 'permit' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'points' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'quote' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'rename' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
else if ( command === 'setgame' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
else if ( command === 'setpoints' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
// MOD only
else if ( command === 'settitle' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'top' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'uptime' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
}
else if ( command === 'watchtime' ' ) {
// SE handles it so nothing here to prevent throwing an ERROR
2022-02-10 04:33:36 +00:00
}
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
}
} ) ;