This commit is contained in:
2025-01-17 22:17:00 +09:00
parent af77c5bc0b
commit 0ea76fc87c

View File

@@ -7,6 +7,21 @@ class InstancePlugin extends BaseInstancePlugin {
this.messageQueue = [];
}
onControllerConnectionEvent(event) {
if (event === "connect") {
for (let [action, content] of this.messageQueue) {
this.sendChat(action, content);
}
this.messageQueue = [];
}
}
sendChat(action, content) {
this.instance.sendTo("controller",
new InstanceActionEvent(this.instance.name, action, content)
);
}
async onOutput(output) {
if (output.type == "action") {
this.messageQueue.push([output.action, output.message]);