2022-02-11 08:03:21 +00:00
// B O T O
2022-02-12 05:05:56 +00:00
2022-02-09 06:55:26 +00:00
require ( 'dotenv' ) . config ( ) ;
2022-02-11 10:44:16 +00:00
const tmi = require ( 'tmi.js' ) ;
2022-02-09 06:55:26 +00:00
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 ( ) ;
2022-02-12 05:08:18 +00:00
// SCAN MSG | START
client . on ( 'message' , ( channel , tags , message , self ) => {
if ( self ) return ;
const badges = tags . badges || { } ; // Scan Badges
const isBroadcaster = badges . broadcaster ; // Define Streamer
const isMod = badges . moderator ; // Define Mod
const isModUp = isBroadcaster || isMod ; // Permission Merge = Mod+Streamer
const isSub = badges . subscriber || badges . founder ; // Define Subs
const botUserState = client . userstate [ channel ] ; // MOD Status Check
const amMod = botUserState !== undefined && botUserState . mod === true ; // Define Mod Status
2022-02-11 11:06:26 +00:00
2022-02-12 05:08:18 +00:00
if ( self || ! message . startsWith ( '!' ) ) return ; // Command Parser
const args = message . slice ( 1 ) . split ( ' ' ) ;
const command = args . shift ( ) . toLowerCase ( ) ; // !COMMAND => command
2022-02-12 05:26:12 +00:00
2022-02-12 21:32:34 +00:00
// CMD | CHAT COMMANDS | Start
2022-02-12 18:33:43 +00:00
2022-02-12 21:32:34 +00:00
// CMD | Color
2022-02-12 19:05:49 +00:00
if ( command === 'color' ) {
2022-02-12 19:26:39 +00:00
// Change your username color. Color must be in hex (#000000) or one of the following: Blue, BlueViolet, CadetBlue, Chocolate, Coral, DodgerBlue, Firebrick, GoldenRod, Green, HotPink, OrangeRed, Red, SeaGreen, SpringGreen, YellowGreen.
2022-02-12 19:05:49 +00:00
client . say ( channel , ` /color ${ args . join ( ' ' ) } ` ) ;
client . say ( channel , ` /me Bleep! Bloop! @ ${ tags . username } has changed my color to ${ args . join ( ' ' ) } ` ) ;
2022-02-12 19:26:39 +00:00
client . say ( channel , ` /me Out of the entire hex (#000000) spectrum or the preset color names: Blue, BlueViolet, CadetBlue, Chocolate, Coral, DodgerBlue, Firebrick, GoldenRod, Green, HotPink, OrangeRed, Red, SeaGreen, SpringGreen, YellowGreen you choose ${ args . join ( ' ' ) } ... Welp, alright! ` ) ;
2022-02-12 19:05:49 +00:00
}
2022-02-12 21:32:34 +00:00
// CMD | CORD
2022-02-12 21:02:13 +00:00
if ( command === 'cord' ||
command === 'discord' ) {
client . say ( channel , ` /me The Cord by Sarimoko is joinable & sharable at: https://cord.sarimoko.com/ ` ) ;
2022-02-12 21:00:12 +00:00
}
2022-02-12 21:32:34 +00:00
// CMD | Dice Roll
2022-02-12 18:33:43 +00:00
if ( command === 'dice' ||
command === 'roll' ) {
const result = Math . floor ( Math . random ( ) * 6 ) + 1 ;
2022-02-12 21:20:10 +00:00
client . say ( channel , ` /me Bleep-Bloop! @ ${ tags . username } has rolled a ${ result } ! Praise RNGesus! ` ) ;
}
2022-02-12 21:32:34 +00:00
// CMD | LURK
2022-02-12 21:20:10 +00:00
if ( command === 'lurk' ||
command === 'lurkin' ||
command === 'lurking' ) {
client . say ( channel , ` /me Bleep-Bloop! Thanks for lurking, your viewership & support is much appriciated! ` ) ;
client . say ( channel , ` !kappagen sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO sarimoLURKbrb sarimoKO ` ) ;
}
2022-02-12 21:32:34 +00:00
// CMD | RAID
2022-02-12 21:20:10 +00:00
if ( command === 'raid' ||
command === 'raidcall' ||
command === 'spam' ||
command === 'spamwars' ) {
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! ` ) ;
2022-02-12 18:33:43 +00:00
}
2022-02-12 21:32:34 +00:00
// CMD | RULE
2022-02-12 21:02:13 +00:00
if ( command === 'rule' ||
command === 'rules' ) {
2022-02-12 21:20:10 +00:00
client . say ( channel , ` /me Bleep-Bloop! Reminder of the Chat Rules ` ) ;
client . say ( channel , ` 1. Do NOT feed the Trolls! ` ) ;
client . say ( channel , ` 2. Do NOT be a Troll! ` ) ;
client . say ( channel , ` 3. Do NOT be another brick in the wall! ` ) ;
}
2022-02-12 21:32:34 +00:00
// CMD | SALE
2022-02-12 21:20:10 +00:00
if ( command === 'sale' ||
command === 'buygames' ||
command === 'humble' ||
command === 'bundle' ||
command === 'humblebundle' ) {
client . say ( channel , ` /me Bleep-Bloop! 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-12 21:02:13 +00:00
}
2022-02-12 21:32:34 +00:00
// CMD | TIME
2022-02-12 21:11:26 +00:00
if ( command === 'time' ||
command === 'pst' ||
command === 'pac' ) {
client . say ( channel , ` /me Bleep-Bloop! PST | 2-Pac Standard Time ` ) ;
}
2022-02-12 21:32:34 +00:00
// CMD | TRIP
2022-02-12 21:11:26 +00:00
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-12 21:32:34 +00:00
// CMD | TUNE
2022-02-12 21:11:26 +00:00
if ( command === 'tune' ||
command === 'lyrics' ||
command === 'midi' ||
command === 'tabs' ) {
client . say ( channel , ` /me The Tune | Lyrics, MIDI, Tabs, & more hosted on Git written in Markdown available at: https://dojo.sarimoko.com/ ` ) ;
}
2022-02-12 21:32:34 +00:00
// CMD | WISH
2022-02-12 21:15:14 +00:00
if ( command === 'whom' ||
command === 'who' ||
command === 'cv' ||
command === 'resume' ||
command === 'portfolio' ) {
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-12 21:32:34 +00:00
// CMD | WISH
2022-02-12 21:11:26 +00:00
if ( command === 'wish' ||
command === 'wishlist' ||
command === 'amazon' ||
command === 'gift' ) {
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-12 20:53:52 +00:00
// TODO:
// Uptime
// Viewers
// Followage
// Followers
2022-02-12 18:33:43 +00:00
// CHAT COMMANDS | End
2022-02-12 07:21:15 +00:00
if ( isSub ) { // SUB | Start
2022-02-12 21:32:34 +00:00
// FX | K A P P A G E N S
2022-02-12 07:21:15 +00:00
} // SUB | END
if ( isModUp ) { // MOD Start
// Shoutout
2022-02-12 05:30:23 +00:00
if ( command === 'so' ||
command === 'shoutout' ) {
2022-02-12 18:42:33 +00:00
client . say ( channel , ` /me Bleep! Bloop! Roll the clip! Smash @ ${ args . join ( ' ' ) } 's follow button at: https://twitch.tv/ ${ args . join ( ' ' ) } ` ) ;
2022-02-12 05:30:23 +00:00
}
2022-02-12 21:11:26 +00:00
if ( command === 'default' ||
command === 'sariboto' ) {
client . say ( channel , ` /color BlueViolet ` ) ;
client . say ( channel , ` /me Bleep-Bloop! I've reconfigured myself to @Sarimoko's preferences! ` ) ;
}
2022-02-12 07:21:15 +00:00
2022-02-12 20:27:34 +00:00
// MOD TOOLS
// CHAT MODES
// Emotes
// Slow
// Subs
// Normalizer
// uniquechat / uniquechatoff
// endpoll deletepoll maybe poll? idk how the bot would edit it
2022-02-12 18:33:43 +00:00
2022-02-12 19:55:28 +00:00
// Run Ads | TODO Fix Permissions...
2022-02-12 07:21:15 +00:00
if ( command === 'ad' ||
command === 'ads' ||
command === 'dab30' ||
command === 'intermission' ) {
2022-02-12 18:33:43 +00:00
client . say ( channel , ` Bleep! Bloop! Sub to bypass ads! ` ) ;
client . commercial ( "channel" , 30 )
. then ( ( data ) => {
2022-02-12 07:21:15 +00:00
// data returns [channel, seconds]
2022-02-12 18:33:43 +00:00
} ) . catch ( ( err ) => {
2022-02-12 07:21:15 +00:00
//
2022-02-12 18:33:43 +00:00
} ) ;
}
2022-02-12 19:55:28 +00:00
// Block
2022-02-12 07:21:15 +00:00
} // MOD | END
2022-02-12 05:37:45 +00:00
} ) ; // SCAN MSG | END
// TTV Re-Active
// ==================================
2022-02-12 19:26:39 +00:00
// TO-DO: Add Follower API
2022-02-12 19:55:28 +00:00
// https://api.twitch.tv/kraken/channels/MY_ID/follows?api_version=5&client_id=MY_CLIENT_ID&limit=1
2022-02-12 05:37:45 +00:00
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. 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 ) => {
2022-02-12 06:10:15 +00:00
client . say ( channel , ` /me BLEEP! BLOOP! @Sarimoko is auto-hosting various streamers! For more info: https://cord.sarimoko.com ` ) ;
2022-02-12 05:37:45 +00:00
} ) ;
client . on ( "join" , ( channel , username , self ) => {
2022-02-12 06:23:09 +00:00
console . log ( '+1 IRC Chatter: ' ) ;
2022-02-12 05:37:45 +00:00
} ) ;
client . on ( "part" , ( channel , username , self ) => {
2022-02-12 06:12:26 +00:00
console . log ( '-1 IRC Chatter' ) ;
2022-02-12 05:37:45 +00:00
// 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" ] ; // IDK
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" ] ; // IDK
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 ) {
2022-02-12 06:25:06 +00:00
client . say ( channel , ` /me BLEEP! BLOOP! Legend re-sub! Thanks for your continued support! ` ) ;
2022-02-12 06:20:01 +00:00
client . say ( channel , ` !kappagen sarimoHYPE sarimoKO ` ) ;
2022-02-12 05:37:45 +00:00
} ) ;
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! ` ) ;
} ) ;