From f8fcdef363b22e6af0b96fe10808cb21a47ad039 Mon Sep 17 00:00:00 2001 From: SirStendec Date: Fri, 27 Sep 2024 18:50:52 -0400 Subject: [PATCH] 4.74.1 * Fixed: The FFZ Control Center button appearing multiple times on the Creator Dashboard. * Fixed: Native global chat badges not appearing correctly. --- package.json | 2 +- src/modules/chat/badges.jsx | 4 +++- src/sites/twitch-twilight/modules/chat/index.js | 16 +++++++++++++--- .../twitch-twilight/modules/menu_button.jsx | 4 ++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 73eedddf..f0a449bd 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.74.0", + "version": "4.74.1", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/modules/chat/badges.jsx b/src/modules/chat/badges.jsx index 75701844..4f0dc3b6 100644 --- a/src/modules/chat/badges.jsx +++ b/src/modules/chat/badges.jsx @@ -1395,7 +1395,9 @@ export default class Badges extends Module { updateTwitchBadges(badges) { this.twitch_badge_count = 0; - if ( ! Array.isArray(badges) ) + if ( ! badges ) + this.twitch_badges = {}; + else if ( ! Array.isArray(badges) ) this.twitch_badges = badges; else { let b = null; diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 6be03bb8..9ba3f671 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -3477,6 +3477,11 @@ export default class ChatHook extends Module { this.updateRoomBitsConfig(cont, props.bitsConfig); + if ( props.globalBadgeData?.badges ) + this.chat.badges.updateTwitchBadges(props.globalBadgeData.badges); + else if (props.data?.badges ) + this.chat.badges.updateTwitchBadges(props.data.badges); + if ( props.data ) { if ( this.shouldUpdateChannel ){ const color = props.data.user?.primaryColorHex; @@ -3489,7 +3494,6 @@ export default class ChatHook extends Module { }); } - this.chat.badges.updateTwitchBadges(props.data.badges); this.updateRoomBadges(cont, props.data.user && props.data.user.broadcastBadges); this.updateRoomRules(cont, props.chatRules); } @@ -3539,14 +3543,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 data = props.data || {}, + const cs = props.data?.user?.broadcastBadges ?? [], + ocs = cont.props.data?.user?.broadcastBadges ?? []; + + const bs = props.globalBadgeData?.badges ?? [], + obs = cont.props.globalBadgeData?.badges ?? []; + + /*const data = props.data || {}, odata = cont.props.data || {}, bs = data.badges || [], obs = odata.badges || [], cs = data.user && data.user.broadcastBadges || [], - ocs = odata.user && odata.user.broadcastBadges || []; + ocs = odata.user && odata.user.broadcastBadges || [];*/ if ( this.chat.badges.getTwitchBadgeCount() !== bs.length || bs.length !== obs.length ) this.chat.badges.updateTwitchBadges(bs); diff --git a/src/sites/twitch-twilight/modules/menu_button.jsx b/src/sites/twitch-twilight/modules/menu_button.jsx index 5808eb20..9c7b99aa 100644 --- a/src/sites/twitch-twilight/modules/menu_button.jsx +++ b/src/sites/twitch-twilight/modules/menu_button.jsx @@ -57,7 +57,7 @@ export default class MenuButton extends Module { );*/ this.SunlightNav = this.elemental.define( - 'sunlight-nav', '.sunlight-top-nav > div > div > div:last-child > div', + 'sunlight-nav', '.sunlight-top-nav > div > div > div > div:last-child > div', Twilight.SUNLIGHT_ROUTES, {attributes: true}, 1 ); @@ -850,4 +850,4 @@ export default class MenuButton extends Module { this.off('i18n:update', this.update); this.off(':clicked', this.loadMenu); } -} \ No newline at end of file +}