diff --git a/package.json b/package.json index a597686b..62609e2f 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "frankerfacez", "author": "Dan Salvato LLC", - "version": "4.46.1", + "version": "4.46.2", "description": "FrankerFaceZ is a Twitch enhancement suite.", "private": true, "license": "Apache-2.0", diff --git a/src/modules/chat/index.js b/src/modules/chat/index.js index ef7fb4ea..bcd701e4 100644 --- a/src/modules/chat/index.js +++ b/src/modules/chat/index.js @@ -2056,7 +2056,7 @@ export default class Chat extends Module { const want_mid = this.context.get('chat.rich.want-mid'); for(const token of tokens) { - if ( token.allow_rich ) + if ( token.allow_rich ?? true ) 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); diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 9028cf6e..3932559b 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -1038,6 +1038,39 @@ export default class ChatHook extends Module { this.updateLineBorders(); //this.updateMentionCSS(); + this.on('chat:get-tab-commands', e => { + e.commands.push({ + name: 'reconnect', + description: 'Force chat to reconnect.', + permissionLevel: 0, + ffz_group: 'FrankerFaceZ' + }) + }); + + this.on('chat:pre-send-message', e => { + const msg = e.message, + inst = e._inst; + + if ( ! /^\/reconnect ?/i.test(msg) ) + return; + + e.preventDefault(); + + 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(); + } + }); + this.RaidController.on('mount', this.wrapRaidController, this); this.RaidController.on('update', this.noAutoRaids, this); this.RaidController.ready((cls, instances) => { @@ -2203,29 +2236,12 @@ export default class ChatHook extends Module { 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; - } - const event = new FFZEvent({ message: msg, extra, context: t.chat.context, channel: inst.props.channelLogin, + _inst: inst, addMessage, sendMessage });