Hi , I live in Taiwan . I want to make a weather request command that the result of the answer is in Chinese .But when I in put command “!weather Taipei” , Nightbot response “Invalid location specified”.I can’t find the error .
$(weather $(query).replace(“Weather for” , “目前”).replace(“Conditions are” , “天氣狀況是”).replace(“with a temperature of” , “溫度是”).replace(“The wind is blowing from the” , “風向是”).replace(“at” , “風速是”).replace(“and the current humidity is” , “目前濕度”))
You forgot a couple things: the
$(eval) at the start, and to close the
$(query), you also used wrong quotation marks:
“” instead of either of these:
$(eval '$(weather $(query))'.replace('Weather for', '目前').replace('Conditions are', '天氣狀況是').replace('with a temperature of', '溫度是').replace('The wind is blowing from the', '風向是').replace('at', '風速是').replace('and the current humidity is', '目前濕度'))
Thank you for your assistance. @Emily
I tried new command variables , but NightBot response “ Unexpected token ‘for’ ” . I still can’t find the error .
I really appreciate your help
That’s my bad, I forgot to specify that the
$(weather) variable is a string, I updated the code above.
OMG . It works .
Thank you very much. @Emily
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.