From 1666ba3b6b63053300d81b98a92f287292a83751 Mon Sep 17 00:00:00 2001 From: Sarimoko Date: Mon, 14 Feb 2022 03:29:53 -0800 Subject: [PATCH] import export setup --- node/alerts.js | 4 +++- node/boto.js | 2 ++ node/rng.js | 28 ++++++++++++++-------------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/node/alerts.js b/node/alerts.js index 931df33..00640ab 100644 --- a/node/alerts.js +++ b/node/alerts.js @@ -1,3 +1,4 @@ +export function ttvalerts() { // TTV Re-Active // ================================== // TO-DO: Add Follower API @@ -191,4 +192,5 @@ client.on("whisper", (from, userstate, message, self) => { if (self) return; console.log('DM | From:'.green, from, userstate, 'MSG:'.green, message); client.say(channel, `/me [+1] Inbox | Received a new SEXT message from: @`+ from +`!`); -}); \ No newline at end of file +}); +} \ No newline at end of file diff --git a/node/boto.js b/node/boto.js index 4676453..197519a 100644 --- a/node/boto.js +++ b/node/boto.js @@ -24,6 +24,8 @@ client.connect(); import { rnguser } from "./rng.js"; rnguser(); +import { ttvalerts } from "./alerts.js"; +ttvalerts(); client.on('message', (channel, tags, message, self) => { if(self) return; diff --git a/node/rng.js b/node/rng.js index 21a6a5a..5203646 100644 --- a/node/rng.js +++ b/node/rng.js @@ -1,24 +1,24 @@ export function rnguser() { // RNG User -function getChatters(channelName, _attemptCount = 0) { - return rp({ - uri: `https://tmi.twitch.tv/group/user/sarimoko/chatters`, - json: true - }) - .then(data => { - return Object.entries(data.chatters) + function getChatters(channelName, _attemptCount = 0) { + return rp({ + uri: `https://tmi.twitch.tv/group/user/sarimoko/chatters`, + json: true + }) + .then(data => { + return Object.entries(data.chatters) .reduce((p, [ type, list ]) => p.concat(list.map(name => { if(name === channelName) type = 'broadcaster'; return { name, type }; })), []); - }) - .catch(err => { - if(_attemptCount < 3) { - return getChatters(channelName, _attemptCount + 1); - } + }) + .catch(err => { + if(_attemptCount < 3) { + return getChatters(channelName, _attemptCount + 1); + } throw err; - }) -} + }) + } function getRandomChatter(channelName, opts = {}) { let {