Default or fallback on $(querystring)?

I’m trying to make a simple command like this one:

!commands add !srank $(leagueoflegends $(querystring) na) (http://na.op.gg/summoner/userName=$(querystring))

When this !srank is called and the following query is empty, I want it to use a default(fallback) variable for example ‘sagajust’. how can i make this happen?

PS I’m quite new to this so this might be something really easy that I just dont know. but help me plz!

Try replacing both of the $(querystring) with just a normal $(query).

You don’t need to pass $(querystring) to the $(leagueoflegends) variable. $(querystring) is only used when you want to url encode the query (useful for your second usage).

true, I fixed it so now its $(leagueoflegends $(query) na)

and also the second line of code is continuation of the first line.

but is there a way to have a fallback value for $(query) or $(querystring)?

What do you mean when say “fallback value”? $(query) will just grab all of the text after the command message. If there is no text after the command $(query) will pass nothing. The $(leagueoflegends variables has fallbacks to provide information such as " Summoner has no rank. " and " Summoner name provided not found. "

i’ll clearify a bit.

In both situation, they are in the same channel and the streamers league summoner name is 'KEVINC’
ex 1) !srank JUST
result: JUST’s current rank: Gold V

ex 2) !srank
result: KEVINC’s current rank: Diamond V

ex1 has a $(query) declared which is JUST and its filling in where it is needed but when ex2 has just the !srank, and no declaration for $(query), I want it to use a default value KEVINC.

Does this clearify? Let me know if this whole question is just outrageous or something, i’m pretty much noob at this :slightly_smiling:

Unfortunately it’s not possible to specify a fall back value at this time, sorry. You would need two different commands, one for looking up the fallback, and one for looking up a specified summoner.

Thank you.
I do currently have !rank for default and !srank for looking up a specified summoner.
hope there is a fallback kind of thing in the future :slightly_smiling:

Thanks again!

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