From 0ea76fc87c8f652a2794f1670a6e65cf5e8bb5d0 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 17 Jan 2025 22:17:00 +0900 Subject: [PATCH] . --- instance.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/instance.js b/instance.js index 93f6749..9e389be 100644 --- a/instance.js +++ b/instance.js @@ -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]);