From cf0840a5416f07235772497c5c6059c0d57f84f6 Mon Sep 17 00:00:00 2001 From: Caleb Fontenot Date: Fri, 7 Apr 2023 10:58:19 -0500 Subject: [PATCH] Add additional stories --- main.cjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/main.cjs b/main.cjs index 4f7dc53..1f02dbd 100644 --- a/main.cjs +++ b/main.cjs @@ -272,11 +272,12 @@ global.madlibNextPrompt = function madlibNextPrompt(client, iteration, selectedS // Send a message in the gameChannel with the next prompt. const channel = client.channels.cache.get(madlibState.gameChannel); let aAn; - let verbArray = ["a", "e", "i", "o", "u"]; - if (phrase[iteration].toLowerCase().charAt(0).includes(verbArray.charAt(0))) { - aAn = "an "; - } else { - aAn = "a "; + let vowelArray = ["a", "e", "i", "o", "u"]; + aAn = "a "; + for (let i = 0; i < vowelArray.length; ++i) { + if (phrase[iteration].toLowerCase().startsWith(vowelArray)) { + aAn = "an "; + } } channel.send("Give me " + aAn + phrase[iteration] + ":\n(" + (phrase.length - iteration) + " words remain)"); }