I currently have a bot that checks every 2 minutes for speciffic twitch channels to be live, so it can send notifications to the respective channels.
I use setInterval to ‘ping’ the twitch API to check if any of the channels are live.
setInterval( function() { twitchHandler(client); }, interval );
the channels are stored in array for so I use a forEach to go trrough everyone and call the twitch API with twitch.js
The notifcation is sent and I flag it so it does not smap it
Of course I still ping the channel to check when it goes offline so i can refresh the notifications for the next time the streamer goes live
This feature is limited by 3 twtich channels per Guild, Since the bot is in 2 Guilds for now I think it is pretty ok.
Now the question as it states in the title. Is this good practice? or Is there another way to listen to specific stream user without using setInterval? Or am I doing ok and I’m just paranoid.
Would like to know a little feedback if I’m on the right track.
Thankyou!