Streams API is crashing my bot

The need of try/catch in a live script such as yours cannot be avoided. This is a great scenario for what it was made to do. There’s no need to shift to another library if you’ve already got the code written how you like

try {

   // try to get or post to the api here
   // as long as twitch returns a response, null or otherwise
   // then the attempt was successful and code continues executing
   // note: it skips the error block of code

} catch(error) {

   // if the get or post failed due to connection errror, timeout, etc ..
   // this area of code will fire
   // the variable `error` will contain any useable data about the error
   // also, despite the error, the script will continue executing further

}
1 Like