Cards against humanity

This commit is contained in:
Daniel Odendahl Jr
2017-11-06 22:23:26 +00:00
parent 012d14b861
commit c8afe4f3fb
5 changed files with 3378 additions and 25 deletions
+15
View File
@@ -82,6 +82,21 @@ class Util {
.replace(/\[i\]|\[\/i\]/g, '*');
}
static async awaitPlayers(msg, max, min, { text = 'join game', time = 30000 }) {
const joined = [];
joined.push(msg.author.id);
const filter = res => {
if (joined.includes(res.author.id)) return false;
if (res.content.toLowerCase() !== text) return false;
joined.push(res.author.id);
return true;
};
const verify = await msg.channel.awaitMessages(filter, { max, time });
verify.set(msg.id, msg);
if (verify.size < min) return false;
return verify.map(message => message.author);
}
static async verify(channel, user, time = 30000) {
const filter = res => {
const value = res.content.toLowerCase();