Weather to another language?

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

Hey @Xepo!

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', '目前濕度'))
1 Like

Thank you for your assistance. @Emily

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:

1 Like

That’s my bad, I forgot to specify that the $(weather) variable is a string, I updated the code above.

1 Like

OMG . It works .

Thank you very much. @Emily :blush:

2 Likes

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