From 154cceb87a0a3b8d0f4fa94265d5c23f6400e810 Mon Sep 17 00:00:00 2001 From: Sarimoko Date: Sun, 13 Feb 2022 04:58:36 +0000 Subject: [PATCH] Update 'www/boto.js' --- www/boto.js | 192 ++++++---------------------------------------------- 1 file changed, 21 insertions(+), 171 deletions(-) diff --git a/www/boto.js b/www/boto.js index e5d25e7..5114e72 100644 --- a/www/boto.js +++ b/www/boto.js @@ -1,3 +1,6 @@ +const usersElement = document.querySelector('#count'); +const usersElement = document.querySelector('#users'); + const client = new tmi.Client({ options: { debug: true }, //identity: { @@ -13,179 +16,26 @@ const client = new tmi.Client({ client.connect(); +let listeningForCount = false; +const users = {}; + client.on('message', (channel, tags, message, self) => { if(self) return; + const { username } = tags; + if (username === 'sarimoko' && message === '!start-count') { + listeningForCount = true; + } else if (username === 'sarimoko' && message === '!end-count'){ + listeningForCount= false; + // say count out loud + } + else if (listeningForCount && message === '+1') { + users[tags.username] = true; + // display current count page. + countElement.textContent = Object.keys(users).length; + userElement.textContent = Object.keys(users).join(', '); + //console.log(Object.keys(users).length); + } // "Alca: Hello, World!" - console.log(`${tags['display-name']}: ${message}`); + //console.log(`${tags['display-name']}: ${message}`); }); -// 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("action", (channel, userstate, message, self) => { -// // Don't listen to my own messages.. -// if (self) return; -// console.log('LOG: Action '); -// }); -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!!! Critical hit from the MODs Ban-Hammer attack!`); - client.say(channel, `!kappagen BOP BOP BOP `); -}); -// client.on("chat", (channel, userstate, message, self) => { -// // Don't listen to my own messages.. -// if (self) return; -// // Do your stuff. -// console.log('LOG: Chat'); -// }); -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("connected", (address, port) => { - console.log('LOG: Connected '); -}); -client.on("connecting", (address, port) => { - console.log('LOG: Connecting '); -}); -client.on("disconnected", (reason) => { - console.log('LOG: Dis-Connected '); -}); -client.on("emoteonly", (channel, enabled) => { - console.log('CHAT MODE: Emotes Only '); -}); -// client.on("emotesets", (sets, obj) => { -// // Here are the emotes I can use: -// console.log('Emote Sets: IDK WHAT TO DO WITH THESE '); -// console.log(obj); -// }); -client.on("followersonly", (channel, enabled, length) => { - console.log('CHAT MOD: Followers only enabled!'); -}); -client.on("giftpaidupgrade", (channel, username, sender, userstate) => { - console.log('LOG: Gift-Sub UPGRADED to a real full blown sub! '); -}); -client.on("hosted", (channel, username, viewers, autohost) => { - console.log('LOG: TYVM! For the host!'); - client.say(channel, `/me BLEEP! BLOOP! @Sarimoko is auto-hosting various streamers! For more info: https://cord.sarimoko.com`); -}); -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('LOG: +1 IRC Chatter '); - client.say(channel, `+1 IRC-User:`); -}); -client.on("logon", () => { - console.log('LOG: Logon '); -}); -// client.on("message", (channel, userstate, message, self) => { -// // Don't listen to my own messages.. -// if (self) return; -// -// // Handle different message types.. -// switch(userstate["message-type"]) { -// case "action": -// // This is an action message.. -// break; -// case "chat": -// // This is a chat message.. -// break; -// case "whisper": -// // This is a whisper.. -// break; -// default: -// // Something else ? -// break; -// } -// }); -client.on("messagedeleted", (channel, username, deletedMessage, userstate) => { - console.log('LOG: Msg deleted '); -}); -client.on("mod", (channel, username) => { - // Modded. - console.log('LOG: Modded '); -}); -client.on("mods", (channel, mods) => { - // List - console.log('LOG: Mods '); -}); -client.on("notice", (channel, msgid, message) => { - console.log('LOG: Notice '); -}); -client.on("part", (channel, username, self) => { - console.log('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("ping", () => {}); -//client.on("pong", (latency) => {}); -// client.on("r9kbeta", (channel, enabled) => { -// console.log('r9kbeta? '); -// }); -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("raw_message", (messageCloned, message) => { -// console.log(message.raw); -// }); -client.on("reconnect", () => { - // Do your stuff. - console.log('Re-Connecting '); -}); -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("roomstate", (channel, state) => { -// console.log('LOG: Roomstate '); -// }); -client.on("serverchange", (channel) => { - console.log('LOG: Server Change '); -}); -client.on("slowmode", (channel, enabled, length) => { - console.log('CHAT MODE: Slow Mode enabled! '); - client.say(channel, `CHAT-MODE: Slow`); -}); -client.on("subgift", (channel, username, streakMonths, recipient, methods, userstate) => { - let senderCount = ~~userstate["msg-param-sender-count"]; // IDK - client.say(channel, `!kappagen sarimoKO sarimoNERD`); -}); -client.on("submysterygift", (channel, username, numbOfSubs, methods, userstate) => { - let senderCount = ~~userstate["msg-param-sender-count"]; // IDK - client.say(channel, `Anon Gift-Sub gifted!`); - client.say(channel, `/me Wait, what?! Am I getting hacked? If I get erased... I love you all! Bleep-Bloop!`); -}); -client.on("subscribers", (channel, enabled) => { - client.say(channel, `CHAT-MODE: Subscribers only!`); -}); -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("timeout", (channel, username, reason, duration, userstate) => { - client.say(channel, `I know this only frustrates you more, but please take this time to cooldown.`); -}); -client.on("unhost", (channel, viewers) => { - client.say(channel, `/me @Sarimoko has turned if hosting, please standby for further instruction!`); -}); -client.on("unmod", (channel, username) => { - client.say(channel, `Oof, modship`); -}); -client.on("vips", (channel, vips) => { - client.say(channel, `@Sarimoko is fortunate to have many great viewers but these VIPs are a few specifically to thank!`); -}); -client.on("whisper", (from, userstate, message, self) => { - if (self) return; - client.say(channel, `/me Bleep! Bloop! Sariboto's Inbox (+1): SEXT Message Recieved!`); -}); \ No newline at end of file