Check live status discord.js

I need help. I need a simple discord.js code that when the bot is online, it checks if the streamer is life. if they are, then the bot status changes and vice versa if they are not online it changes to something else. I’ve tried so many methods and couldn’t find anything in 4 hours. Please help

Personally I use webhooks for this

https://dev.twitch.tv/docs/api/webhooks-guide

But you can also long poll the streams API for changes to stream status

Yes, i’ve already seen those and i still have no idea how to write the code for it.

Yes, i’ve already seen those and i still have no idea how to write the code for it.

  • You need to decide if you are going to use Webhooks (needs a server that is basically a “website” to receive data), or poll the API endpoint on a schedule
  • You need to pick a library for making HTTP requests in nodeJS.
  • If you are using Webhooks you need to decide if you are going to expose the bot to the web (bad idea), or devise a service for receiving webhook payloads and relay a message between your webhook receive and your bot,
  • If going separate service, pick a library and/or language to write that service in
  • If you are using long poll determine a way to store the state of the stream, so you don’t notify for a live stream being live when you already notified for it being live. (You might want this for Webhooks to to debounce stream restarts for example)

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