diff --git a/src/main.js b/src/main.js index 37591d56..281e4d26 100644 --- a/src/main.js +++ b/src/main.js @@ -100,7 +100,7 @@ class FrankerFaceZ extends Module { FrankerFaceZ.Logger = Logger; const VER = FrankerFaceZ.version_info = { - major: 4, minor: 0, revision: 0, extra: '-rc13.1', + major: 4, minor: 0, revision: 0, extra: '-rc13.2', commit: __git_commit__, build: __webpack_hash__, toString: () => diff --git a/src/modules/main_menu/components/setting-combo-box.vue b/src/modules/main_menu/components/setting-combo-box.vue new file mode 100644 index 00000000..ddd73f51 --- /dev/null +++ b/src/modules/main_menu/components/setting-combo-box.vue @@ -0,0 +1,112 @@ + + + \ No newline at end of file diff --git a/src/sites/twitch-twilight/modules/chat/index.js b/src/sites/twitch-twilight/modules/chat/index.js index 58fb0e50..9e7d11ef 100644 --- a/src/sites/twitch-twilight/modules/chat/index.js +++ b/src/sites/twitch-twilight/modules/chat/index.js @@ -414,7 +414,15 @@ export default class ChatHook extends Module { for(const inst of instances) { inst.client.events.removeAll(); + + inst._ffzInstall(); + inst.connectHandlers(); + + inst.props.setChatConnectionAPI({ + sendMessage: inst.sendMessage, + _ffz_inst: inst + }); } }); @@ -732,6 +740,7 @@ export default class ChatHook extends Module { wrapChatService(cls) { const t = this, + old_mount = cls.prototype.componentDidMount, old_handler = cls.prototype.connectHandlers; cls.prototype._ffz_was_here = true; @@ -760,6 +769,53 @@ export default class ChatHook extends Module { } + cls.prototype._ffzInstall = function() { + if ( this._ffz_installed ) + return; + + this._ffz_installed = true; + + const inst = this, + old_send = this.sendMessage; + + inst.sendMessage = function(raw_msg) { + const msg = raw_msg.replace(/\n/g, ''); + + if ( msg.startsWith('/ffz') ) { + inst.addMessage({ + type: t.chat_types.Notice, + message: 'The /ffz command is not yet re-implemented.' + }) + + return false; + } + + const event = new FFZEvent({ + message: msg, + channel: inst.props.channelLogin + }); + + t.emit('chat:pre-send-message', event); + + if ( event.defaultPrevented ) + return; + + return old_send.call(this, msg); + } + } + + + cls.prototype.componentDidMount = function() { + try { + this._ffzInstall(); + } catch(err) { + t.log.error('Error installing FFZ features onto chat service.', err); + } + + return old_mount.call(this); + } + + cls.prototype.connectHandlers = function(...args) { if ( ! this._ffz_init ) { const i = this; @@ -775,32 +831,6 @@ export default class ChatHook extends Module { } } - const old_send = this.sendMessage; - this.sendMessage = function(raw_msg) { - const msg = raw_msg.replace(/\n/g, ''); - - if ( msg.startsWith('/ffz') ) { - this.postMessage({ - type: t.chat_types.Notice, - message: 'The /ffz command is not yet re-implemented.' - }) - - return false; - } - - const event = new FFZEvent({ - message: msg, - channel: this.channelLogin - }); - - t.emit('chat:pre-send-message', event); - - if ( event.defaultPrevented ) - return; - - return old_send.call(this, msg); - } - const old_chat = this.onChatMessageEvent; this.onChatMessageEvent = function(e) { if ( e && e.sentByCurrentUser ) {