Modified List Help

Continuing the discussion from Creating commands involving modified lists:

So I’ve been using this format for quite a few things when it comes to inputting particular Queries. I have a Question on how one would add a third option/variable here

!moves
$(eval var w = [`Please re-enter the command and either 'flames' or 'coyotes' , Or let a Mod know `]; var c = [`https://bit.ly/3n2WeXQ`]; `$(query)` == `coyotes` || `$(query)` == `yotes` || `$(query)` == `Yotes` || `$(query)` == `Coyotes` ; var f = [`https://bit.ly/3q23eXa`]; `$(query)` == `Flames` || `$(query)` == `flames` || `$(query)` == `atlanta` || `$(query)` == `Atlanta` ? (c) : (f) : (w);)

I thought this might work but I dont have anything parsing the query(?). so it doesnt work as intended giving only a response of Unexpected token ':' I dont know how to get this to work but i love the way this command string works with a two option series of either its on the list or its not.
any ideas?

Hey @kanarenee!

Before answering your question, I find that you overcomplicated your code, so I’ll simplify it as well:

$(eval w = `Please re-enter the command and either 'flames' or 'coyotes' , or let a mod know`; c = `https://bit.ly/3n2WeXQ`; f = `https://bit.ly/3q23eXa`; q = `$(query)`.toLowerCase(); q == `coyotes` || q == `yotes` ? c : q == `flames` || q == `atlanta` ? f : w;)

First, I removed the arrays [], you don’t need them here; then I saved $(query) in lowercase in a variable, so when I do the test I only need to test for the lowercase; and finally, I fixed your ternary operator, the first one was in the middle of nowhere and didn’t have any impact because it wasn’t finished, and the second had an extra else case, you can combine multiple ternary operators together, hopefully reading my code will help you understand how it works, if not, consider sticking to if tests for now, they’re basically the same thing, you just avoid using syntactic sugar, which tend to complicate things if you don’t know how to use it.

Okay so first off thank you for simplifying it, I had seen how the command worked from the original post and never actually modified it myself to shorten it/ clean it up properly. (Also i’m sad to say i did have it in the proper order prior to asking and over thought it and deleted the change due to being unsure)
As for the string you’ve given me, the variables being inputted aren’t spitting out the links on my end. When I use the command (which i’ve dubbed !moves) it only returns the w value stating “Please re-enter the command and either ‘flames’ or ‘coyotes’ , or let a mod know” regardless of what is being inputted
*Update it seems the .toLowerCase() portion of the command doesn’t properly work due to it not being a string? as it works fine without it

Right, my bad, I misplaced a backtick, I fixed my code above.
.toLowerCase() was added to the query instead of modifying it.
You can see the modification by clicking on the pencil on the top right of my message.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.