This commit is contained in:
Dragon Fire
2020-11-09 18:00:34 -05:00
parent e37f658efd
commit 17dd3f23fb
+4 -1
View File
@@ -35,7 +35,10 @@ module.exports = class AcrosticCommand extends Command {
run(msg, { word }) {
const results = [];
for (const letter of word) {
if (letter === ' ') results.push(' ');
if (letter === ' ') {
results.push(' ');
continue;
}
const filteredWords = words.filter(wrd => wrd.startsWith(letter.toLowerCase()));
const chosen = filteredWords[Math.floor(Math.random() * filteredWords.length)];
results.push(`**${letter.toUpperCase()}**${chosen.slice(1)}`);