How to add json custom api command to Nightbot? Weather

Hello, I tried to write a command for Nightbot.
Which will show in the twitch chat what the weather is today in the city indicated with a space.
!weather town.По%20географическому%20объекту
Here is the documentation.
Many thanks for any help in advance!

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:

1 Like

Hello @Emily , thanks for the help <3
it is possible to convert km/h m/s, or multiplication factor 3.6?

Yes you can, let’s say the weather is in the w variable, here’s how to do it:

const windSpeedInMetersPerSecond = ( parseInt( w.match(/\d+km\/h/)[0] ) * 3.6 ).toFixed(2); w.replace(/\d+km\/h/, windSpeedInMetersPerSecond + 'm/s');
1 Like

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