more
This commit is contained in:
parent
e7f35a27be
commit
4bc44f17e7
27
node/rng.js
27
node/rng.js
|
@ -20,15 +20,15 @@ export function rnguser() {
|
|||
})
|
||||
}
|
||||
|
||||
function getRandomChatter(channelName, opts = {}) {
|
||||
let {
|
||||
onlyViewers = false,
|
||||
noBroadcaster = false,
|
||||
skipList = []
|
||||
} = opts;
|
||||
return getChatters(channelName)
|
||||
.then(data => {
|
||||
let chatters = data
|
||||
function getRandomChatter(channelName, opts = {}) {
|
||||
let {
|
||||
onlyViewers = false,
|
||||
noBroadcaster = false,
|
||||
skipList = []
|
||||
} = opts;
|
||||
return getChatters(channelName)
|
||||
.then(data => {
|
||||
let chatters = data
|
||||
.filter(({ name, type }) =>
|
||||
!(
|
||||
(onlyViewers && type !== 'viewers') ||
|
||||
|
@ -36,10 +36,9 @@ function getRandomChatter(channelName, opts = {}) {
|
|||
skipList.includes(name)
|
||||
)
|
||||
);
|
||||
return chatters.length === 0 ?
|
||||
return chatters.length === 0 ?
|
||||
null :
|
||||
chatters[Math.floor(Math.random() * chatters.length)];
|
||||
});
|
||||
} // RNG END
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue