openweathermap nighbot

Hello, i am newb at this stuff.

how to make a request?, when specified !weather $(city) - will show a specific city, and with just !weather, it will show a given city, for example London.
I managed to achieve this(or i got help):

$(eval M=Math.round;if($(query) == ``){c=London} else {c=$(query)}; E=$(urlfetch json https://api.openweathermap.org/data/2.5/weather?q=${c}&APPID=e37f25f76c5129d614ce6800f52a3adc&lang=ru&units=metric);Погода ${E.name}: ${E.weather[0].description}, температура ${M(E.main.temp)}°C (ощущается как ${M(E.main.feels_like)}°C), ветер ${M(E.wind.deg)}° со скоростью ${M(E.wind.speed)}м/с, относительная влажность воздуха ${M(E.main.humidity)}%.; )

Hey @VillsEK!

I could help you fix your code, but Nightbot has a $(weather) variable already, why don’t you use it?
Admittedly, at the time of writing this answer, it has an issue, but it should be resolved soon.

You can also translate its output by following this guide, or this guide.

Hello Emily, for some reason I made a post Weather possible values and Function

1 Like

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