This commit is contained in:
Sarimoko 2022-02-14 03:38:50 -08:00
parent e7f35a27be
commit 4bc44f17e7
1 changed files with 13 additions and 14 deletions

View File

@ -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
}
});
}
}