rng
This commit is contained in:
parent
315b11fa41
commit
e138f0eecf
62
node/boto.js
62
node/boto.js
|
@ -17,6 +17,8 @@ const client = new tmi.Client({
|
|||
channels: [ process.env.TTV_CHANNELS ]
|
||||
});
|
||||
|
||||
client.connect();
|
||||
|
||||
// RNG User
|
||||
const rp = require('request-promise'); // For RNG
|
||||
function getChatters(channelName, _attemptCount = 0) {
|
||||
|
@ -60,10 +62,36 @@ const client = new tmi.Client({
|
|||
chatters[Math.floor(Math.random() * chatters.length)];
|
||||
});
|
||||
}
|
||||
|
||||
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
|
||||
if(command === 'rnguser') {
|
||||
// Get a random user but skip the user requesting a random user
|
||||
getRandomChatter(channel, { skipList: [ tags.username ] })
|
||||
.then(user => {
|
||||
if(user === null) {
|
||||
client.say(channel, `Sorry ${tags.username}, this is embarrassing... There was no one to choose from! #smallstreamerproblems Bleep-Bloop!`);
|
||||
}
|
||||
else {
|
||||
let { name, type } = user;
|
||||
client.say(channel, `${tags.username} exluded, at random I choose "${name}" cuz they're such an amazing ${type}!`);
|
||||
}
|
||||
})
|
||||
.catch(err => console.log('[ERR]', err));
|
||||
}
|
||||
|
||||
client.connect();
|
||||
|
||||
});
|
||||
// ALERTS START
|
||||
// ================================
|
||||
// --------------------------------
|
||||
|
@ -335,33 +363,3 @@ client.on("whisper", (from, userstate, message, self) => {
|
|||
});
|
||||
// ALERTS STOP
|
||||
// ================================
|
||||
|
||||
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
|
||||
if(command === 'rnguser') {
|
||||
// Get a random user but skip the user requesting a random user
|
||||
getRandomChatter(channel, { skipList: [ tags.username ] })
|
||||
.then(user => {
|
||||
if(user === null) {
|
||||
client.say(channel, `Sorry ${tags.username}, this is embarrassing... There was no one to choose from! #smallstreamerproblems Bleep-Bloop!`);
|
||||
}
|
||||
else {
|
||||
let { name, type } = user;
|
||||
client.say(channel, `${tags.username} exluded, at random I choose "${name}" cuz they're such an amazing ${type}!`);
|
||||
}
|
||||
})
|
||||
.catch(err => console.log('[ERR]', err));
|
||||
}
|
||||
|
||||
});
|
Loading…
Reference in New Issue