Prevent blacklisted users from playing games

This commit is contained in:
Dragon Fire
2021-02-14 20:46:12 -05:00
parent ddd1eeb317
commit f98e1700d5
29 changed files with 30 additions and 10 deletions
+2 -1
View File
@@ -253,7 +253,7 @@ module.exports = class Util {
return arr[Number.parseInt(msgs.first().content, 10) - 1];
}
static async awaitPlayers(msg, max, min = 1) {
static async awaitPlayers(msg, max, min, blacklist) {
if (max === 1) return [msg.author.id];
const addS = min - 1 === 1 ? '' : 's';
await msg.say(
@@ -263,6 +263,7 @@ module.exports = class Util {
joined.push(msg.author.id);
const filter = res => {
if (res.author.bot) return false;
if (blacklist.includes(res.author.id)) return false;
if (joined.includes(res.author.id)) return false;
if (res.content.toLowerCase() !== 'join game') return false;
joined.push(res.author.id);