Closed jaredthecoder closed 1 year ago
I did more investigating. Perhaps the badges not being shown under the old links is the root cause. I need to dig more later, but need to head to bed now. However, see below for more details.
Twitch seemed to have removed the ability to query for badges at https://badges.twitch.tv/v1/badges/channels/summit1g/display (Summit1g as example) that was previously documented here - https://discuss.dev.twitch.tv/t/how-to-get-emotes-badges-object/18916 - but unofficially. Currently that is done here in Twoku - https://github.com/worldreboot/twitch-reloaded-roku/blob/2a4f618bb9d87f53d7b39d1c1d391a3f5f0cb030/components/ChatTest.brs#L72.
The new behavior of Twitch is to return these badges in real-time as chat messages are sent and are fetched from the Twitch CDN like here - https://gist.github.com/jaredthecoder/9ffb6866cb75e194367b0e789f6cff18. It looks like this can be done with an app access token or when logged in via https://dev.twitch.tv/docs/api/reference/#get-channel-chat-badges.
It looks like this is now fixed on its own. From what I can tell, neither my forked version merged here nor the official Twoku version were updated since it wasn't working yesterday and the day before, so my assumption is that something on the Twoku developer access to Twitch and/or Roku needed to be renewed/fixed such that the badges response wouldn't fail as it was.
I will close this for now b/c the optional chaining handling, while a good defensive coding mechanism against an expected invalid value, in this case never should have been invalid per the Twitch API spec, and it isn't worth merging this to break compatibility with pre-11.0 Roku OS (when optional chaining with the ?.
operator was introduced).
Hmm the behavior hasn't changed for me (still crashes). Did you have to do anything on the client side to get it working again?
Same, I see the issues again too.
Yeah this doesn’t work. Need to open again, as it seemed to Bork it even worse now
This is just a temporary fix to handle invalid channel + global badge messages sent until the underlying issue is addressed.
I will keep digging until I figure out where Twitch's
badge_sets
response is not getting handled correctly between yesterday when working and today.In the meantime, this will fix the issue (and will ensure it works if Twitch reverts back to the prior manner of sending badges) so long as the Roku OS is 11.0+ (which released in early 2022) since I used the optional chaining with
?
(https://developer.roku.com/docs/references/brightscript/language/expressions-variables-types.md#optional-chaining-operators).