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 18:33:43 +00:00
|
|
|
// CHAT COMMANDS | Start
|
|
|
|
|
|
|
|
// CORD
|
2022-02-12 05:24:23 +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 05:23:13 +00:00
|
|
|
}
|
2022-02-12 18:33:43 +00:00
|
|
|
if(command === 'dice' ||
|
|
|
|
command === 'roll') {
|
|
|
|
const result = Math.floor(Math.random() * 6) + 1;
|
|
|
|
client.say(channel, `@${tags.username}, You rolled a ${result}.`);
|
|
|
|
}
|
|
|
|
// DOJO
|
|
|
|
if(command === 'dojo' ||
|
|
|
|
command === 'lessons') {
|
|
|
|
client.say(channel, `/me The Dojo by Sarimoko a collection of coarses, guides, lessons, & tutorials available at: https://dojo.sarimoko.com/`);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHAT COMMANDS | End
|
|
|
|
|
2022-02-12 07:21:15 +00:00
|
|
|
if(isSub) { // SUB | Start
|
2022-02-12 05:37:45 +00:00
|
|
|
|
2022-02-12 07:21:15 +00:00
|
|
|
// HYPE
|
2022-02-12 05:37:45 +00:00
|
|
|
if(command === 'hype' ||
|
|
|
|
command === 'train' ||
|
|
|
|
command === 'hypetrain') {
|
|
|
|
client.say(channel, `!kappagen sarimoHYPE sarimoBITS sarimoHYPE sarimoBITS`);
|
|
|
|
}
|
|
|
|
|
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:41:47 +00:00
|
|
|
if(${args.join(' ')} === '') {
|
|
|
|
client.say(channel, `/me Bleep! Bloop! Oops, looks like ${tags.username} for to tag someone!`);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
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 07:21:15 +00:00
|
|
|
|
2022-02-12 07:11:48 +00:00
|
|
|
// CHAT MODE: Emotes
|
|
|
|
if(command === 'emoteonly') {
|
|
|
|
client.say(channel, `/me Bleep! Bloop! ${tags.username} just activated EMOTE ONLY chat! Show Sir SPAM'a'LOT who's boss!`);
|
|
|
|
client.say(channel, `/emoteonly `);
|
|
|
|
}
|
|
|
|
if(command === 'emoteoff' ||
|
|
|
|
command === 'emoteonlyoff') {
|
|
|
|
client.say(channel, `/me Bleep! Bloop! ${tags.username} turned off EMOTE ONLY chat! Chatter freely!`);
|
|
|
|
client.say(channel, `/emoteonlyoff `);
|
|
|
|
}
|
2022-02-12 07:21:15 +00:00
|
|
|
|
2022-02-12 07:11:48 +00:00
|
|
|
// CHAT MODE: Subs
|
|
|
|
if(command === 'subsonly') {
|
|
|
|
client.say(channel, `/me Bleep! Bloop! ${tags.username} just activated SUBS ONLY chat! Loyal supports FTW!`);
|
|
|
|
client.say(channel, `/subscribers `);
|
|
|
|
}
|
|
|
|
if(command === 'subsoff' ||
|
|
|
|
command === 'subscribersoff') {
|
|
|
|
client.say(channel, `/me Bleep! Bloop! ${tags.username} turned off Subs ONLY chat! Welcome back you filthy followers!`);
|
|
|
|
client.say(channel, `/subscribersoff `);
|
|
|
|
}
|
2022-02-12 07:21:15 +00:00
|
|
|
|
2022-02-12 07:11:48 +00:00
|
|
|
// CHAT MODE: Normal
|
|
|
|
if(command === 'norm' ||
|
|
|
|
command === 'normal') {
|
2022-02-12 07:21:15 +00:00
|
|
|
client.say(channel, `/me Bleep! Bloop! ${tags.username} has normalized chat!`);
|
2022-02-12 07:11:48 +00:00
|
|
|
client.say(channel, `/emoteonlyoff `);
|
|
|
|
client.say(channel, `/followersoff `);
|
|
|
|
client.say(channel, `/slowoff `);
|
|
|
|
client.say(channel, `/subscribersoff `);
|
|
|
|
}
|
2022-02-12 18:33:43 +00:00
|
|
|
|
|
|
|
// Run Ads
|
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 07:21:15 +00:00
|
|
|
|
|
|
|
} // MOD | END
|
|
|
|
|
2022-02-12 05:37:45 +00:00
|
|
|
}); // SCAN MSG | END
|
|
|
|
|
|
|
|
// TTV Re-Active
|
|
|
|
// ==================================
|
|
|
|
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!`);
|
|
|
|
});
|