From d4d307c4fd58ab9a0a9e40899705843448d9ce56 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Fri, 15 Aug 2025 20:10:16 +0900 Subject: [PATCH] . --- message.js | 51 ++++++++++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/message.js b/message.js index 4408e2e..dcef1a8 100644 --- a/message.js +++ b/message.js @@ -1,33 +1,26 @@ -// import { Type, Static } from "@sinclair/typebox"; -const {Type, Static} = require("@sinclair/typebox"); +const { Type } = require("@sinclair/typebox"); -export class ChatEvent { - // declare ["constructor"]: typeof ChatEvent; - // as const - static type = "event"; - // as const - static src = ["control", "instance"]; - // as const - static dst = "instance"; - // as const - static plugin = "global_chat"; - static permission = null; +class ChatEvent { + static type = "event"; + static src = ["control", "instance"]; + static dst = "instance"; + static plugin = "global_chat"; + static permission = null; + + static jsonSchema = Type.Object({ + "instanceName": Type.String(), + "content": Type.String(), + }); - /* - constructor( - public instanceName: string, - public content: string, - ) { - } - */ + constructor(instanceName, content) { + this.instanceName = instanceName; + this.content = content; + } - static jsonSchema = Type.Object({ - "instanceName": Type.String(), - "content": Type.String(), - }); + static fromJSON(json) { + return new ChatEvent(json.instanceName, json.content); + } +} - // json: Static - static fromJSON(json) { - return new this(json.instanceName, json.content); - } -} \ No newline at end of file +// If you need to use this class in other files +module.exports = { ChatEvent };