Weather to another language?

Asked Aug 5, 2021·4 replies·Last activity 5 years ago·Open in Discord ↗
Archived from the original community forum
Things may have changed since it was written. Still stuck? Ask the community on Discord.

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" , "目前濕度"))

4 replies

Hey @Brisk Rhino!

You forgot a couple things: the $(eval) at the start, and to close the $(weather) after $(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. @Polar Cat

I tried new command variables , but NightBot response “ Unexpected token 'for' ” . I still can't find the error . :disappointed_relieved:

I really appreciate your help :grinning:

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. @Polar Cat 😊