1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-30 06:28:31 +00:00

Fix Twitch chat badges not rendering. They removed badgeSets from the chat container, so for now access the raw data and parse it ourselves. It's actually about the same difficulty, so it should work fine.

This commit is contained in:
SirStendec 2018-01-19 17:17:16 -05:00
parent 0754144c36
commit 4c9e67a22e
4 changed files with 92 additions and 52 deletions

View file

@ -621,9 +621,9 @@ export default class ChatHook extends Module {
if ( ! this.addRoom(cont, props) )
return;
if ( props.badgeSets ) {
this.chat.badges.updateTwitchBadges(props.badgeSets.globalsBySet);
this.updateRoomBadges(cont, props.badgeSets.channelsBySet);
if ( props.data ) {
this.chat.badges.updateTwitchBadges(props.data.badges);
this.updateRoomBadges(cont, props.data.user && props.data.user.broadcastBadges);
}
}
@ -639,20 +639,20 @@ export default class ChatHook extends Module {
// can't compare the badgeSets property in any reasonable way.
// Instead, just check the lengths to see if they've changed
// and hope that badge versions will never change separately.
const bs = props.badgeSets,
obs = cont.props.badgeSets,
const data = props.data || {},
odata = cont.props.data || {},
bsgl = bs.globalsBySet && bs.globalsBySet.size || 0,
obsgl = obs.globalsBySet && obs.globalsBySet.size || 0,
bs = data.badges || [],
obs = odata.badges || [],
bscl = bs.channelsBySet && bs.channelsBySet.size || 0,
obscl = obs.channelsBySet && obs.channelsBySet.size || 0;
cs = data.user && data.user.broadcastBadges || [],
ocs = odata.user && odata.user.broadcastBadges || [];
if ( bsgl !== obsgl )
this.chat.badges.updateTwitchBadges(bs.globalsBySet);
if ( bs.length !== obs.length )
this.chat.badges.updateTwitchBadges(bs);
if ( bscl !== obscl )
this.updateRoomBadges(cont, bs.channelsBySet);
if ( cs.length !== ocs.length )
this.updateRoomBadges(cont, cs);
}
updateRoomBadges(cont, badges) { // eslint-disable-line class-methods-use-this