From e1ade7089859c74365ffe4940304f92ac6f4d3a4 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Sun, 15 Jun 2025 02:38:44 +0900 Subject: [PATCH] . --- instance.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/instance.js b/instance.js index 3c0f9be..ef5050e 100644 --- a/instance.js +++ b/instance.js @@ -8,12 +8,15 @@ class InstancePlugin extends BaseInstancePlugin { onControllerConnectionEvent(event) { if (event === 'connect') { - for (let [action, content] of this.messageQueue) {this.instance.sendTo('controller', new InstanceActionEvent(this.instance.name, action, content))}; + for (const [action, content] of this.messageQueue) {try {this.instance.sendTo('controller', new InstanceActionEvent(this.instance.name, action, content))} catch (err) {this.messageQueue.push([output.action, output.message])}} this.messageQueue = []; } } - async onOutput(output) {if (output.type == 'action') {if (this.host.connector.connected) {this.instance.sendTo('controller', new InstanceActionEvent(this.instance.name, output.action, output.message));} else {this.messageQueue.push([output.action, output.message]);}}} + async onOutput(output) { + if (output.type !== 'action') return; + if (this.host.connector.connected) {this.instance.sendTo('controller', new InstanceActionEvent(this.instance.name, output.action, output.message))} else {this.messageQueue.push([output.action, output.message])} + } } module.exports = {InstancePlugin};