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 = {}) {
|
function getRandomChatter(channelName, opts = {}) {
|
||||||
let {
|
let {
|
||||||
onlyViewers = false,
|
onlyViewers = false,
|
||||||
noBroadcaster = false,
|
noBroadcaster = false,
|
||||||
skipList = []
|
skipList = []
|
||||||
} = opts;
|
} = opts;
|
||||||
return getChatters(channelName)
|
return getChatters(channelName)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
let chatters = data
|
let chatters = data
|
||||||
.filter(({ name, type }) =>
|
.filter(({ name, type }) =>
|
||||||
!(
|
!(
|
||||||
(onlyViewers && type !== 'viewers') ||
|
(onlyViewers && type !== 'viewers') ||
|
||||||
|
@ -36,10 +36,9 @@ function getRandomChatter(channelName, opts = {}) {
|
||||||
skipList.includes(name)
|
skipList.includes(name)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return chatters.length === 0 ?
|
return chatters.length === 0 ?
|
||||||
null :
|
null :
|
||||||
chatters[Math.floor(Math.random() * chatters.length)];
|
chatters[Math.floor(Math.random() * chatters.length)];
|
||||||
});
|
});
|
||||||
} // RNG END
|
}
|
||||||
|
}
|
||||||
}
|
|
Loading…
Reference in New Issue