Emily
May 22, 2023, 10:22am
2
Hey @Nexodacimal !
This API won’t work with Nightbot because you need to send an authorization token in the header of your requests, and Nightbot doesn’t offer this option.
Why not use the $(weather)
variable ?
And if you need/want to translate it:
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', '目前濕度'))
Hey @leonxnez and @snattanzi !
It seems to me your issue is mostly the lack of space to write the code, right?
To answer your question, yes, you can use Pastebin to expand your code, here’s how to do it:
$(eval w='$(weather $(query))'; $(urlfetch json https://pastebin.com/raw/XXXXXXXXX))
And in your paste:
w.replace().replace().replace().[...].replace()
Since you’ll have more room to write the code, I recommend using regex in the replace to match expressions regardless of the capitalization…
1 Like