Thank you for the response @Gerhard
I ended up getting it to work with eval which was a bit of a challenge more so because of the long command and trying to keep the character limit in check as I need the same eval in the command twice along with lengthy urlfetch variables.
I am sending data to an API endpoint and trying to pass along a number from a second (optional) argument in the command. The number is essentially the number of times a thing has happened. If the command is used without entering a number, the assumption is that we should pass along a 1.
The command is used in one of two ways:
!thething CLIPURL (no number which should default/assume a 1) or
!thething CLIPURL 4 (with number and should use the number provided)
The eval working as I need is:
$(eval if("$(2)">1){"$(2)";}else{"1";})
I tried several iterations of evaluating if $(2) was null or undefined and if so, pass in a 1, but I kept getting null as a result. I am guessing this may be due to $(2) not existing at all? So I figured out that if I check to see if it's greater than 1, even if it doesn't exist, I suppose that returns the appropriate result.