2022-02-11 08:03:21 +00:00
// B O T O
2022-02-13 14:21:44 +00:00
// ---
2022-02-14 09:25:11 +00:00
// black
2022-02-13 14:21:44 +00:00
// red
// green
// yellow
// blue
// magenta
// cyan
2022-02-14 09:25:11 +00:00
// white
// gray
// grey
// brightRed
// brightGreen
// brightYellow
// brightBlue
// brightMagenta
// brightCyan
// brightWhite
2022-02-13 14:21:44 +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-13 14:27:53 +00:00
const rp = require ( 'request-promise' ) ; // For RNG
const colors = require ( 'colors' ) ;
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-14 09:46:55 +00:00
import { rnguser } from "./rng.js" ;
rnguser ( ) ;
2022-02-12 22:28:55 +00:00
2022-02-12 05:08:18 +00:00
// SCAN MSG | START
2022-02-12 22:42:00 +00:00
client . on ( 'message' , ( channel , tags , message , self ) => {
2022-02-12 05:08:18 +00:00
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-13 01:19:22 +00:00
// CMD | RNGUser
2022-02-12 22:40:21 +00:00
if ( command === 'rnguser' ) {
2022-02-12 22:28:55 +00:00
// Get a random user but skip the user requesting a random user
2022-02-12 22:42:52 +00:00
getRandomChatter ( channel , { skipList : [ tags . username ] } )
2022-02-12 22:28:55 +00:00
. then ( user => {
if ( user === null ) {
2022-02-12 23:29:11 +00:00
client . say ( channel , ` Sorry ${ tags . username } , this is embarrassing... There was no one to choose from! #smallstreamerproblems Bleep-Bloop! ` ) ;
2022-02-12 22:28:55 +00:00
}
else {
let { name , type } = user ;
2022-02-12 23:29:11 +00:00
client . say ( channel , ` ${ tags . username } exluded, at random I choose " ${ name } " cuz they're such an amazing ${ type } ! ` ) ;
2022-02-12 22:28:55 +00:00
}
} )
. catch ( err => console . log ( '[ERR]' , err ) ) ;
}
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 ( ' ' ) } ` ) ;
2022-02-12 22:10:53 +00:00
client . say ( channel , ` /me @ ${ 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 22:10:53 +00:00
// CMD | Code
if ( command === 'code' ||
command === 'git' ||
command === 'repo' ||
command === 'dev' ) {
client . say ( channel , ` /me The CODE | Open-Source code available 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' ) {
2022-02-13 01:19:22 +00:00
const result = Math . floor ( Math . random ( ) * 6 ) + 1 ;
client . say ( channel , ` /me RNGesus has rolled @ ${ tags . username } a ${ result } ! ` ) ;
2022-02-12 21:20:10 +00:00
}
2022-02-12 22:10:53 +00:00
// CMD | Dojo
2022-02-12 21:51:22 +00:00
if ( command === 'dojo' ||
2022-02-13 04:15:36 +00:00
command === 'guide' ||
command === 'tutor' ||
command === 'lessons' ||
command === 'lesson' ||
command === 'coarse' ||
command === 'guide' ||
command === 'guides' ) {
2022-02-12 22:10:53 +00:00
client . say ( channel , ` /me The Dojo | DIY's & 1on1's available at: https://cord.sarimoko.com/ ` ) ;
2022-02-12 21:51:22 +00:00
}
2022-02-12 22:10:53 +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-13 04:15:36 +00:00
// CMD | Mark
if ( command === 'mark' ||
command === 'merch' ||
command === 'mousepad' ||
command === 'shirts' ||
command === 'stickers' ) {
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 22:10:53 +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 22:10:53 +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 22:10:53 +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 22:10:53 +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 22:10:53 +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 22:10:53 +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 22:19:50 +00:00
// CMD | Weed
if ( command === 'weed' ||
command === 'pot' ||
command === 'dab' ||
command === 'dab30' ||
command === 'roach' ||
command === 'roach30' ||
command === 'bong' ||
command === 'joint' ||
command === 'bongs' ||
command === 'pipe' ) {
client . say ( channel , ` /me The Sarimoko Show is an adults only channel based in California where we've passed Prop 64: Adult Use of Marijuana Act. Marijuana and Cannabis is not for everyone, please seek a professional for further guidance on THC and CBD. ` ) ;
}
2022-02-12 22:10:53 +00:00
// CMD | Whom
2022-02-12 21:15:14 +00:00
if ( command === 'whom' ||
command === 'who' ||
command === 'cv' ||
command === 'resume' ||
command === 'portfolio' ) {
2022-02-12 23:37:10 +00:00
client . say ( channel , ` /me Who's asking? ${ tags . username } if you're a cop you HAVE to tell me, right?! CV/Portfolio/Resume is available at: https://whom.sarimoko.com/ ` ) ;
2022-02-12 21:15:14 +00:00
}
2022-02-12 22:10:53 +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 22:10:53 +00:00
// CMD | SOCIAL PLATFORMS
// CMD | Cord
if ( command === 'cord' ||
command === 'discord' ) {
client . say ( channel , ` /me The Cord | The official Discod to join & share at: https://cord.sarimoko.com/ ` ) ;
}
if ( command === 'fb' ||
2022-02-12 22:12:53 +00:00
command === 'facebook' ||
2022-02-12 22:10:53 +00:00
command === '' ) {
client . say ( channel , ` /me Facebook | https://facebook.com/sarimoko.o ` ) ;
}
if ( command === 'insta' ||
command === 'ig' ||
command === 'instagram' ) {
client . say ( channel , ` /me Instagram | https://instagram.com/sari.moko ` ) ;
}
if ( command === 'reddit' ||
command === 'subreddit' ) {
client . say ( channel , ` /me Reddit | https://reddit.com/r/sarimoko_o ` ) ;
}
// CMD | Social
if ( command === 'social' ||
command === 'socials' ||
command === 'linktree' ) {
client . say ( channel , ` /me YouTube | https://youtube.com/c/sarimoko ` ) ;
client . say ( channel , ` /me Instagram | https://instagram.com/sari.moko ` ) ;
client . say ( channel , ` /me Facebook | https://facebook.com/sarimoko.o ` ) ;
client . say ( channel , ` /me Reddit | https://reddit.com/r/sarimoko_o ` ) ;
client . say ( channel , ` /me TikTok | https://twitter.com/@sarimoko ` ) ;
client . say ( channel , ` /me Twitter | https://twitter.com/sarimoko_o ` ) ;
}
if ( command === 'tiktok' ||
command === 'tik' ||
command === 'tok' ) {
client . say ( channel , ` /me TikTok | https://twitter.com/@sarimoko ` ) ;
}
if ( command === 'twitter' ||
command === 'tweet' ) {
client . say ( channel , ` /me Twitter | https://twitter.com/sarimoko_o ` ) ;
}
2022-02-12 23:29:11 +00:00
if ( command === 'twitter' ||
command === 'tweet' ) {
client . say ( channel , ` /me Twitter | https://twitter.com/sarimoko_o ` ) ;
}
// MINI GAME
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 21:35:51 +00:00
if ( command === 'bg' ||
command === 'notgg' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoDEAD sarimoGAME Bleep-Bloop! ` ) ;
2022-02-12 21:35:51 +00:00
}
2022-02-12 21:40:02 +00:00
if ( command === 'clap' ||
command === 'claps' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoDEAD sarimoGAME Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
if ( command === 'hair' ||
command === 'hairflip' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoHAIR sarimoBANG Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
if ( command === 'hi' ||
command === 'hello' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoKO sarimoNERD Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
if ( command === 'hype' ||
command === 'train' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoHYPE sarimoBITS Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
if ( command === 'salt' ||
command === 'shoutout' ) {
2022-02-12 21:51:22 +00:00
client . say ( channel , ` !kappagen sarimoSALT sarimoRAGE Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
if ( command === 'soup' ||
command === 'sup' ) {
client . say ( channel , ` !kappagen sarimoSOUP sarimoTRIP ` ) ;
2022-02-12 21:51:22 +00:00
client . say ( channel , ` /me Yo @ ${ tags . username } , how goes it? Bleep-Bloop! ` ) ;
2022-02-12 21:40:02 +00:00
}
2022-02-12 21:32:34 +00:00
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 21:51:22 +00:00
client . say ( channel , ` /me Roll the clip! Smash @ ${ args . join ( ' ' ) } 's follow button at: https://twitch.tv/ ${ args . join ( ' ' ) } Bleep-Bloop! ` ) ;
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 ` ) ;
2022-02-12 21:51:22 +00:00
client . say ( channel , ` /me I've reconfigured myself to @Sarimoko's preferences! Bleep-Bloop! ` ) ;
client . say ( channel , ` /emoteonlyoff ` ) ;
client . say ( channel , ` /followersoff ` ) ;
client . say ( channel , ` /slowoff ` ) ;
client . say ( channel , ` /subscribersoff ` ) ;
2022-02-12 21:11:26 +00:00
}
2022-02-12 21:51:22 +00:00
if ( command === 'mute' ||
command === 'slap' ||
command === 'timeout' ||
command === 'warn' ) {
client . say ( channel , ` /timeout ${ args . join ( ' ' ) } 33 ` ) ;
client . say ( channel , ` /me Mods cast a 33sec Timeout Curse on @ ${ args . join ( ' ' ) } , resistence to Bans is decreased! ` ) ;
client . say ( channel , ` !kappagen sarimoRAGE sarimoNERD ` ) ;
}
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 22:19:50 +00:00
//if(command === 'ad' ||
//command === 'ads' ||
//command === 'dab30' ||
//command === 'intermission') {
// client.say(channel, `/me @Sarimoko lets have a secret 30 second conversation with only our loyal subs while the ads run! Enjoy the commercials followering no subbing plebs! Wait @sarimoko makes money off ads too... Well this is awkward thank you peasants for not using adblocker! Wait I'm making it worse... Bleep-Bloop!`);
// client.say(channel, `!kappagen sarimoKO sarimoBANG`);
// client.commercial("channel", 30)
// .then((data) => {
// // data returns [channel, seconds]
// }).catch((err) => {
// //
// });
//}
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-13 00:13:37 +00:00
2022-02-13 00:46:27 +00:00
// client.on("action", (channel, userstate, message, self) => {
// // Don't listen to my own messages..
// if (self) return;
// console.log('LOG: Action ');
// });