mirror of
https://github.com/PHIDIAS0303/ClusterChatSync.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -8,12 +8,15 @@ class InstancePlugin extends BaseInstancePlugin {
|
|||||||
|
|
||||||
onControllerConnectionEvent(event) {
|
onControllerConnectionEvent(event) {
|
||||||
if (event === 'connect') {
|
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 = [];
|
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};
|
module.exports = {InstancePlugin};
|
||||||
|
|||||||
Reference in New Issue
Block a user