A chatbot was developed to show weather information about a specific region during a stream. Showing this data both in chat and on screen.
New Year, New Resources
The app can be run only local because it uses OBS overalay to show weather information. Alert, the repository is Source Code Link
The bot uses a Mapbox API to search for the coordinates of a city informed by the user and also uses an AccuWeather API to get the city's climate information informed. With the data of these APIs, it is reserved for viewers as climatic information in the broadcast chat and also in the broadcast overlay.
During a stream on the twitch there can be dozens, hundreds or even levels of people interacting with the bot, and, consequently, the bot can suffer from performance problems.
In this way, a new relic platform has been integrated into the bot to monitor its performance. The new relic platform makes it possible to create a panel that allows viewing the number of requests per second that the bot receives, the total processing time for each request and the time spent for each external API call, and also the time spent for displaying the requests. chat information and without the overlay.
Clone the project, and create a file named
.env, with some credentials, being:
BOT_NAME= Name of your Twitch bot CHANNEL_NAME= Name of your Twitch channel TOKEN= Your Twitch Token MAPBOX_TOKEN= Your Mapbox Token WEATHER_TOKEN= Your Accuweather Token UNIT= Your temperature unit, like F (Fahrenheit) or C (Celsius) LANGUAGE_WEATHER= The language of Weather, like en or pt
After this, create a project in New Relic get the file
newrelic.js, and put in the same folder of
index.js, and WeatherBot will be connected to New Relic.
Now, you need to run
npm install to install all dependencies, and
npm start to start the bot! After starting the bot, acess
http://localhost:3000 in your OBS (Using a OBS Browser Overlay), and the data will be shown on the screen.
During the stream, a viewer can type
!weather <city_name> in the twitch chat and the bot will get the climatic information from the specified city and will show it on the screen and in the chat too.
The project are under the MIT License.
On several occasions in the twitch, we see that the subject is little debated and that several people are not aware of the climatic difference between cities and countries.
The goal of weather bot for twitch is to democratize access to climate information in cities when the topic is being addressed in a live twitch.
I build it with NodeJS and Socket.io. I used New Relic to see the time of each request, the use of memory/cpu, and the time what the bot is running. This is very good to know if the code is slow or fast, consuming much memory,etc.