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; }); // R E A C T I V E // ================================== client.on("anongiftpaidupgrade", (channel, username, userstate) => { // Do your stuff. client.whisper(username, `UPGRADE COMPLETE! Thank you very much for supporting The Sarimoko Show!`); }); 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`); client.say(channel, `The Rule of Law`); 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`); }); // User joins/connects client.on("join", (channel, username, self) => { client.say(channel, `/me +1 Chatter! Viewer or Bot...? Time will tell!`); }); // Bye Felicia! 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*`); }); // Incoming Raid client.on("raided", (channel, username, viewers) => { client.say(channel, `/me Welcome raiders!!! We make 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) => { // 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"]; }); client.on("resub", function (channel, username, months, message, userstate, methods) { // Do your stuff. client.say(channel, `/me Re-SUB test`); }); client.on("subscription", function (channel, username, method, message, userstate) { // Do your stuff. 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!`); }); // !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 // + // + 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; // M O D S Q U A D // ---------------------------------- //let isMod = user.mod || user['user-type'] === 'mod'; //let isBroadcaster = channel.slice(1) === user.username; //let isModUp = isMod || isBroadcaster; //if(isModUp) { // Something for moderators or higher //} // I N F O // ================================== // The Cord // ---------------------------------- if(command === 'cord' || command === 'discord') { client.say(channel, `/me The Cord by Sarimoko is joinable & sharable at: https://cord.sarimoko.com/`); } // The Template // ---------------------------------- else if(command === 'template' || command === 'example') { client.say(channel, `/me @${tags.username} says ${args.join(' ')} BLEEP! BLOOP!`); } // The Boto // ---------------------------------- else if(command === 'boto' || command === 'sariboto' || command === 'sari-boto') { client.say(channel, `/me Bleep! Bloop! Twitch IRC connected... LETS PARTY!!!`); client.say(channel, `!kappagen imGlitch EarthDay imGlitch EarthDay imGlitch`); } // The Color // ---------------------------------- else if(command === 'color') { client.say(channel, `/color ${args.join(' ')}`); 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/`); } // The Echo // ---------------------------------- else if(command === 'echo') { client.say(channel, `/me @${tags.username} says ${args.join(' ')}`); } // The Hair // ---------------------------------- else if(command === 'hair' || command === 'hairflip' || command === 'bang' || command === 'headbang') { client.say(channel, `!kappagen sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR sarimoBANG sarimoHAIR `); } // 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! `); } // 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 `); } // 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`); } // The Wish // ---------------------------------- else 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/ `); } // 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 } // E R R O R S // ================================== // NOT FOUND FUNCTION else { client.say(channel, `/me Bleep! Bloop! Error! Sorry, @${tags.username} hopefully SE/SL/Nitebot has ya covered...`); } });