diff --git a/package.json b/package.json index 1afc7d73..a34b0334 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.15.5", + "version": "4.16.0", "description": "FrankerFaceZ is a Twitch enhancement suite.", "license": "Apache-2.0", "scripts": { diff --git a/src/bridge.js b/src/bridge.js index 19fd4f57..02a9fd6a 100644 --- a/src/bridge.js +++ b/src/bridge.js @@ -82,7 +82,9 @@ class FFZBridge extends Module { ffz_type: 'loaded', data: out }); - } + + } else if ( msg.ffz_type === 'change' ) + this.onChange(msg); } send(msg) { // eslint-disable-line class-methods-use-this @@ -91,6 +93,17 @@ class FFZBridge extends Module { } catch(err) { this.log.error('send error', err); /* no-op */ } } + onChange(msg) { + const key = msg.key, + value = msg.value, + deleted = msg.deleted; + + if ( deleted ) + this.settings.provider.delete(key); + else + this.settings.provider.set(key, value); + } + onProviderChange(key, value, deleted) { this.send({ ffz_type: 'change', diff --git a/src/modules/chat/actions/index.jsx b/src/modules/chat/actions/index.jsx index ee655ddc..b4a018e5 100644 --- a/src/modules/chat/actions/index.jsx +++ b/src/modules/chat/actions/index.jsx @@ -437,12 +437,11 @@ export default class Actions extends Module { if ( ! data || ! data.action || ! data.appearance ) continue; - const ap = data.appearance || {}, - disp = data.display || {}, + let ap = data.appearance || {}; + const disp = data.display || {}, + act = this.actions[data.action]; - def = this.renderers[ap.type]; - - if ( ! def || disp.disabled || + if ( ! act || disp.disabled || (disp.mod_icons != null && disp.mod_icons !== !!mod_icons) || (disp.mod != null && disp.mod !== (current_user ? !!current_user.mod : false)) || (disp.staff != null && disp.staff !== (current_user ? !!current_user.staff : false)) || @@ -453,12 +452,23 @@ export default class Actions extends Module { (disp.followersOnly != null && disp.followersOnly !== current_room.followersOnly) ) continue; + if ( act.override_appearance ) { + const out = act.override_appearance.call(this, Object.assign({}, ap), data, null, current_room, current_user, mod_icons); + if ( out ) + ap = out; + } + + const def = this.renderers[ap.type]; + if ( ! def ) + continue; + const has_color = def.colored && ap.color, + disabled = maybe_call(act.disabled, this, data, null, current_room, current_user, mod_icons) || false, color = has_color && (chat && chat.colors ? chat.colors.process(ap.color) : ap.color), contents = def.render.call(this, ap, createElement, color); actions.push(