Update 'node/boto.js'
This commit is contained in:
parent
748724793b
commit
dd6eabc3e7
|
@ -20,6 +20,7 @@ const client = new tmi.Client({
|
||||||
|
|
||||||
client.connect();
|
client.connect();
|
||||||
|
|
||||||
|
// RNG User
|
||||||
const rp = require('request-promise');
|
const rp = require('request-promise');
|
||||||
|
|
||||||
function getChatters(channelName, _attemptCount = 0) {
|
function getChatters(channelName, _attemptCount = 0) {
|
||||||
|
@ -62,10 +63,10 @@ function getRandomChatter(channelName, opts = {}) {
|
||||||
null :
|
null :
|
||||||
chatters[Math.floor(Math.random() * chatters.length)];
|
chatters[Math.floor(Math.random() * chatters.length)];
|
||||||
});
|
});
|
||||||
}
|
} // RNG END
|
||||||
|
|
||||||
// SCAN MSG | START
|
// SCAN MSG | START
|
||||||
client.on('message', (channel, tags, message, self) => {
|
client.on('message', (channel, userstate, tags, message, self) => {
|
||||||
if(self) return;
|
if(self) return;
|
||||||
const badges = tags.badges || {}; // Scan Badges
|
const badges = tags.badges || {}; // Scan Badges
|
||||||
const isBroadcaster = badges.broadcaster; // Define Streamer
|
const isBroadcaster = badges.broadcaster; // Define Streamer
|
||||||
|
@ -80,9 +81,9 @@ client.on('message', (channel, tags, message, self) => {
|
||||||
const command = args.shift().toLowerCase(); // !COMMAND => command
|
const command = args.shift().toLowerCase(); // !COMMAND => command
|
||||||
|
|
||||||
// CMD | CHAT COMMANDS | Start
|
// CMD | CHAT COMMANDS | Start
|
||||||
if(command === 'randomuser') {
|
if(command === 'rnguser') {
|
||||||
// Get a random user but skip the user requesting a random user
|
// Get a random user but skip the user requesting a random user
|
||||||
getRandomChatter(channel, { skipList: [ tags.username ] })
|
getRandomChatter(channel, { skipList: [ userstate.username ] })
|
||||||
.then(user => {
|
.then(user => {
|
||||||
if(user === null) {
|
if(user === null) {
|
||||||
client.send(channel, `${userstate.username}, there was no one to choose.`);
|
client.send(channel, `${userstate.username}, there was no one to choose.`);
|
||||||
|
|
Loading…
Reference in New Issue