import export setup
This commit is contained in:
parent
8053eb44d9
commit
1666ba3b6b
|
@ -1,3 +1,4 @@
|
|||
export function ttvalerts() {
|
||||
// TTV Re-Active
|
||||
// ==================================
|
||||
// TO-DO: Add Follower API
|
||||
|
@ -192,3 +193,4 @@ client.on("whisper", (from, userstate, message, self) => {
|
|||
console.log('DM | From:'.green, from, userstate, 'MSG:'.green, message);
|
||||
client.say(channel, `/me [+1] Inbox | Received a new SEXT message from: @`+ from +`!`);
|
||||
});
|
||||
}
|
|
@ -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;
|
||||
|
|
28
node/rng.js
28
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 {
|
||||
|
|
Loading…
Reference in New Issue