mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 10:19:11 +02:00
Fix
This commit is contained in:
@@ -42,16 +42,20 @@ module.exports = class AnagramicaCommand extends Command {
|
|||||||
**You have ${time} seconds to provide anagrams for the following letters:**
|
**You have ${time} seconds to provide anagrams for the following letters:**
|
||||||
${letters.map(letter => `\`${letter.toUpperCase()}\``).join(' ')}
|
${letters.map(letter => `\`${letter.toUpperCase()}\``).join(' ')}
|
||||||
`);
|
`);
|
||||||
|
const picked = [];
|
||||||
const filter = res => {
|
const filter = res => {
|
||||||
if (res.author.id !== msg.author.id) return false;
|
if (res.author.id !== msg.author.id) return false;
|
||||||
|
if (picked.includes(res.content.toLowerCase())) return false;
|
||||||
const score = this.getScore(letters, res.content.toLowerCase());
|
const score = this.getScore(letters, res.content.toLowerCase());
|
||||||
if (!score) return false;
|
if (!score) return false;
|
||||||
if (!valid.includes(res.content.toLowerCase())) {
|
if (!valid.includes(res.content.toLowerCase())) {
|
||||||
points -= score;
|
points -= score;
|
||||||
|
picked.push(res.content.toLowerCase());
|
||||||
res.react(FAILURE_EMOJI_ID || '❌').catch(() => null);
|
res.react(FAILURE_EMOJI_ID || '❌').catch(() => null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
points += score;
|
points += score;
|
||||||
|
picked.push(res.content.toLowerCase());
|
||||||
res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null);
|
res.react(SUCCESS_EMOJI_ID || '✅').catch(() => null);
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user