diff --git a/package.json b/package.json index 3ba4be94..a597686b 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.46.0", + "version": "4.46.1", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/experiments.json b/src/experiments.json index 3cd5aa3f..1edc1968 100644 --- a/src/experiments.json +++ b/src/experiments.json @@ -1,12 +1,4 @@ { - "line_renderer": { - "name": "Modular Chat Line Rendering", - "description": "Enable a newer, modular chat line renderer.", - "groups": [ - {"value": true, "weight": 100}, - {"value": false, "weight": 0} - ] - }, "api_load": { "name": "New API Stress Testing", "description": "Send duplicate requests to the new API server for load testing.", diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js index 40ec9d16..ef7fb4ea 100644 --- a/src/modules/chat/index.js +++ b/src/modules/chat/index.js @@ -2056,11 +2056,12 @@ export default class Chat extends Module { const want_mid = this.context.get('chat.rich.want-mid'); for(const token of tokens) { - for(const provider of providers) - if ( provider.test.call(this, token, msg) ) { - token.hidden = provider.can_hide_token && (this.context.get('chat.rich.hide-tokens') || provider.hide_token); - return provider.process.call(this, token, want_mid); - } + if ( token.allow_rich ) + for(const provider of providers) + if ( provider.test.call(this, token, msg) ) { + token.hidden = provider.can_hide_token && (this.context.get('chat.rich.hide-tokens') || provider.hide_token); + return provider.process.call(this, token, want_mid); + } } } diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 3d600aaa..9028cf6e 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -1691,6 +1691,45 @@ export default class ChatHook extends Module { } */ else if ( msg.type === types.Moderation ) { t.emit('chat:mod-user', msg.moderationType, msg.userLogin, msg.targetMessageID, msg); + // Special handling + if ( ! inst.props.isCurrentUserModerator ) { + const type = msg.moderationType, + target = msg.userLogin; + + // Whee~ + let mat; + if ( type === mod_types.Ban ) + mat = 'ban'; + else if ( type === mod_types.Timeout ) + mat = 'timeout'; + else if ( type === mod_types.Delete ) + mat = 'delete'; + + if ( mat ) + msg.moderationActionType = mat; + + // Handle moderation events ourself if it's not + // a delete, so that we can pass the action info. + if ( ! inst.moderatedUsers.has(target) && type !== mod_types.Delete ) { + inst.moderateBuffers( + [ + inst.buffer, + inst.delayedMessageBuffer.map(e => e.event) + ], + target, + msg + ); + + inst.delayedMessageBuffer.push({ + event: msg, + time: Date.now(), + shouldDelay: false + }); + + return; + } + } + } /*else if ( msg.type === types.ModerationAction && false && inst.markUserEventDeleted && inst.unsetModeratedUser ) { if ( !((! msg.level || ! msg.level.length) && msg.targetUserLogin && msg.targetUserLogin === inst.props.currentUserLogin) ) { //t.log.info('Moderation Action', msg); @@ -2159,7 +2198,25 @@ export default class ChatHook extends Module { inst.addMessage({ type: t.chat_types.Notice, message: 'The /ffz command is not yet re-implemented.' - }) + }); + + return false; + } + + if ( msg === '/reconnect' ) { + if ( ! inst.client?.reconnect ) + inst.addMessage({ + type: t.chat_types.Notice, + message: t.i18n.t('chat.reconnect.unable', 'FFZ is unable to force chat to reconnect.') + }); + else { + inst.addMessage({ + type: t.chat_types.Notice, + message: t.i18n.t('chat.reconnect', 'FFZ is forcing chat to reconnect...') + }); + + inst.client.reconnect(); + } return false; } diff --git a/src/sites/twitch-twilight/modules/chat/line.js b/src/sites/twitch-twilight/modules/chat/line.js index 5dee3ecd..00fbac7b 100644 --- a/src/sites/twitch-twilight/modules/chat/line.js +++ b/src/sites/twitch-twilight/modules/chat/line.js @@ -366,7 +366,7 @@ export default class ChatLine extends Module { this.updateLines(); }); - this.on('experiments:changed:line_renderer', () => { + /*this.on('experiments:changed:line_renderer', () => { const value = this.experiments.get('line_renderer'), cls = this.ChatLine._class; @@ -379,7 +379,7 @@ export default class ChatLine extends Module { this.rerenderLines(); } - }); + });*/ for(const setting of RERENDER_SETTINGS) this.chat.context.on(`changed:${setting}`, this.rerenderLines, this); @@ -1095,7 +1095,7 @@ other {# messages were deleted by a moderator.} } } }; - cls.prototype.ffzOldRender = function() { try { + /*cls.prototype.ffzOldRender = function() { try { this._ffz_no_scan = true; const types = t.parent.message_types || {}, @@ -1238,7 +1238,7 @@ other {# messages were deleted by a moderator.} if ( ds && ds.user ) { try { target_user = JSON.parse(ds.user); - } catch(err) { /* nothing~! */ } + } catch(err) { /* nothing~! * / } } const fe = new FFZEvent({ @@ -1691,11 +1691,13 @@ other {# messages were deleted by a moderator.} return 'An error occurred rendering this chat line.'; } - } } + } } */ - cls.prototype.render = this.experiments.get('line_renderer') + /*cls.prototype.render = this.experiments.get('line_renderer') ? cls.prototype.ffzNewRender - : cls.prototype.ffzOldRender; + : cls.prototype.ffzOldRender;*/ + + cls.prototype.render = cls.prototype.ffzNewRender; // Do this after a short delay to hopefully reduce the chance of React // freaking out on us.