roydejong / timbot

🤖 Discord bot that announces Twitch channels going live
MIT License
102 stars 38 forks source link

Can't get stream information #6

Closed Khaztaroth closed 4 years ago

Khaztaroth commented 4 years ago

I've set up the bot and configured the file with my Client ID and bot ID. I have a handful of channels I'm monitoring but no matter who goes online or at what point I always get

[TwitchMonitor]` Did not receive a response from the server with stream info.

I'm just getting into node development so I'm not sure how to debug it to see if it's a problem with my twitch client ID (I had a lot of 401 errors when trying to write a simple test app to fetch stream data) or somewhere else.

Here's how my config file is set up, not sure about the limitation on how many channels can be checked but I manage a fairly large community of streamers and I need a tool that would let me send notifications for 25+ live channels throughout the day. Timbot is the only tool I could see myself using since I rather have full control of the code.

{
  "bot_token": "NzEzMDc2NTEwNjY3MzA5****.******.****htYzhez1XpGHuehpinFBA48",

  "discord_announce_channel": "anouncements",
  "discord_fooduse_channel": "",
  "discord_mentions": {
    "channel_sample_1": "here",
    "channel_sample_2": ""
  },

  "twitch_client_id": "800fe***m0r3***utp***c1biqvccm",
  "twitch_client_secret":"1xck5k9***my2iy***2iaq9****bj9",
  "twitch_check_interval_ms": 60000,
  "twitch_channels":"messengerofdunk,shanhearts,slamdunkingbenedetto,heliiux,secretsleepoversociety,nerdyjane,khaztaroth315,leprechaunkoala,misbac,juststevenyaffe,ionicart,jacuzzitubbs,trendzilla_,shalaemon,annaikonline,nathansothershow,geektomplays,zacoyama,wickerfiend95,ancarrowart,cheshiretaurus,wibbledibbles,itsbremily,deamagicka,ArkaeicOne",
  "voice_enabled": false,
  "voiced_replies": true,

  "twitter_names": [],
  "twitter_api_key": "",
  "twitter_api_secret": "",
  "twitter_access_token": "",
  "twitter_access_token_secret": ""
}
roydejong commented 4 years ago

Twitch has dropped support for the old API, so stream info wasn't working anymore.

I updated the bot today (106ae7112ee843bb8cfb1e93eff42ecad841a4c8) so it now integrates with the new Twitch API (Helix). This complicates set up somewhat, so I've updated the README file as well.

This whole update needs more testing, but stream notifications should work again.

Khaztaroth commented 4 years ago

This is working perfectly now, I do have one quick question, is there any way I could implement using the user profile picture instead of a thumbnail from the stream?

roydejong commented 4 years ago

The API endpoint that I'm currently using (/helix/streams) doesn't have that information, so the way to implement this would be to request channel information separately by hitting /helix/users which gives you the profile_image_url.