267 lines
11 KiB
JavaScript
267 lines
11 KiB
JavaScript
// B O T O
|
|
|
|
require('dotenv').config();
|
|
const tmi = require('tmi.js');
|
|
|
|
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();
|
|
|
|
// 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
|
|
|
|
if(self || !message.startsWith('!')) return; // Command Parser
|
|
const args = message.slice(1).split(' ');
|
|
const command = args.shift().toLowerCase(); // !COMMAND => command
|
|
|
|
// CMD | CHAT COMMANDS | Start
|
|
|
|
// CMD | Color
|
|
if(command === 'color') {
|
|
// 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.
|
|
client.say(channel, `/color ${args.join(' ')}`);
|
|
client.say(channel, `/me Bleep! Bloop! @${tags.username} has changed my color to ${args.join(' ')}`);
|
|
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!`);
|
|
}
|
|
// CMD | CORD
|
|
if(command === 'cord' ||
|
|
command === 'discord') {
|
|
client.say(channel, `/me The Cord by Sarimoko is joinable & sharable at: https://cord.sarimoko.com/`);
|
|
}
|
|
// CMD | Dice Roll
|
|
if(command === 'dice' ||
|
|
command === 'roll') {
|
|
const result = Math.floor(Math.random() * 6) + 1;
|
|
client.say(channel, `/me Bleep-Bloop! @${tags.username} has rolled a ${result}! Praise RNGesus!`);
|
|
}
|
|
// CMD | LURK
|
|
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 `);
|
|
}
|
|
// CMD | RAID
|
|
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!`);
|
|
}
|
|
// CMD | RULE
|
|
if(command === 'rule' ||
|
|
command === 'rules') {
|
|
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!`);
|
|
}
|
|
// CMD | SALE
|
|
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`);
|
|
}
|
|
// CMD | TIME
|
|
if(command === 'time' ||
|
|
command === 'pst' ||
|
|
command === 'pac') {
|
|
client.say(channel, `/me Bleep-Bloop! PST | 2-Pac Standard Time`);
|
|
}
|
|
// CMD | TRIP
|
|
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...`);
|
|
}
|
|
// CMD | TUNE
|
|
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/`);
|
|
}
|
|
// CMD | WISH
|
|
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/ `);
|
|
}
|
|
// CMD | WISH
|
|
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/ `);
|
|
}
|
|
// TODO:
|
|
// Uptime
|
|
// Viewers
|
|
// Followage
|
|
// Followers
|
|
// CHAT COMMANDS | End
|
|
|
|
if(isSub) { // SUB | Start
|
|
// FX | K A P P A G E N S
|
|
if(command === 'bg' ||
|
|
command === 'notgg') {
|
|
client.say(channel, `!kappagen sarimoDEAD sarimoGAME `);
|
|
}
|
|
if(command === 'clap' ||
|
|
command === 'claps') {
|
|
client.say(channel, `!kappagen sarimoDEAD sarimoGAME `);
|
|
}
|
|
if(command === 'hair' ||
|
|
command === 'hairflip') {
|
|
client.say(channel, `!kappagen sarimoHAIR sarimoBANG `);
|
|
}
|
|
if(command === 'hi' ||
|
|
command === 'hello') {
|
|
client.say(channel, `!kappagen sarimoKO sarimoNERD `);
|
|
}
|
|
if(command === 'hype' ||
|
|
command === 'train') {
|
|
client.say(channel, `!kappagen sarimoHYPE sarimoBITS `);
|
|
}
|
|
if(command === 'salt' ||
|
|
command === 'shoutout') {
|
|
client.say(channel, `!kappagen sarimoSALT sarimoRAGE `);
|
|
}
|
|
if(command === 'soup' ||
|
|
command === 'sup') {
|
|
client.say(channel, `!kappagen sarimoSOUP sarimoTRIP `);
|
|
client.say(channel, `/me Yo @${tags.username}, how goes it?`);
|
|
}
|
|
|
|
} // SUB | END
|
|
|
|
if(isModUp) { // MOD Start
|
|
|
|
// Shoutout
|
|
if(command === 'so' ||
|
|
command === 'shoutout') {
|
|
client.say(channel, `/me Bleep! Bloop! Roll the clip! Smash @${args.join(' ')}'s follow button at: https://twitch.tv/${args.join(' ')}`);
|
|
}
|
|
if(command === 'default' ||
|
|
command === 'sariboto') {
|
|
client.say(channel, `/color BlueViolet`);
|
|
client.say(channel, `/me Bleep-Bloop! I've reconfigured myself to @Sarimoko's preferences!`);
|
|
}
|
|
|
|
// MOD TOOLS
|
|
|
|
// CHAT MODES
|
|
// Emotes
|
|
// Slow
|
|
// Subs
|
|
// Normalizer
|
|
// uniquechat / uniquechatoff
|
|
// endpoll deletepoll maybe poll? idk how the bot would edit it
|
|
|
|
// Run Ads | TODO Fix Permissions...
|
|
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) => {
|
|
//
|
|
});
|
|
}
|
|
// Block
|
|
|
|
} // MOD | END
|
|
|
|
}); // SCAN MSG | END
|
|
|
|
// TTV Re-Active
|
|
// ==================================
|
|
// TO-DO: Add Follower API
|
|
// https://api.twitch.tv/kraken/channels/MY_ID/follows?api_version=5&client_id=MY_CLIENT_ID&limit=1
|
|
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) => {
|
|
client.say(channel, `/me BLEEP! BLOOP! @Sarimoko is auto-hosting various streamers! For more info: https://cord.sarimoko.com`);
|
|
});
|
|
client.on("join", (channel, username, self) => {
|
|
console.log('+1 IRC Chatter: ');
|
|
});
|
|
client.on("part", (channel, username, self) => {
|
|
console.log('-1 IRC Chatter');
|
|
// 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) {
|
|
client.say(channel, `/me BLEEP! BLOOP! Legend re-sub! Thanks for your continued support!`);
|
|
client.say(channel, `!kappagen sarimoHYPE sarimoKO`);
|
|
});
|
|
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!`);
|
|
}); |