This commit is contained in:
2025-06-15 02:38:44 +09:00
parent f63ebf6afb
commit e1ade70898

View File

@@ -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};