From 56e20d0a5d437b0163c94817ae6cc4439644fa06 Mon Sep 17 00:00:00 2001 From: PHIDIAS Date: Thu, 14 Aug 2025 12:47:49 +0900 Subject: [PATCH] . --- controller.js | 2 +- message.ts => message.js | 19 +++++++++++++------ package.json | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) rename message.ts => message.js (53%) diff --git a/controller.js b/controller.js index b7dbfd6..83037a5 100644 --- a/controller.js +++ b/controller.js @@ -3,7 +3,7 @@ const Discord = require('discord.js'); const fetch = require('node-fetch'); const {BaseControllerPlugin} = require('@clusterio/controller'); const {InstanceActionEvent} = require('./info.js'); -import { ChatEvent } from "./messages"; +import { ChatEvent } from "./message.js"; const MAX_DISCORD_MESSAGE_LENGTH = 1950; const MIN_CONFIDENCE_SCORE = 10.0; diff --git a/message.ts b/message.js similarity index 53% rename from message.ts rename to message.js index 8c58d27..3299bf2 100644 --- a/message.ts +++ b/message.js @@ -1,24 +1,31 @@ import { Type, Static } from "@sinclair/typebox"; export class ChatEvent { - declare ["constructor"]: typeof ChatEvent; - static type = "event" as const; - static src = ["control", "instance"] as const; - static dst = "instance" as const; - static plugin = "global_chat" as const; + // 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; + /* constructor( public instanceName: string, public content: string, ) { } + */ static jsonSchema = Type.Object({ "instanceName": Type.String(), "content": Type.String(), }); - static fromJSON(json: Static) { + // json: Static + static fromJSON(json) { return new this(json.instanceName, json.content); } } \ No newline at end of file diff --git a/package.json b/package.json index cb1b057..1571933 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ }, "dependencies": { "discord.js": "^14.19.3", + "@sinclair/typebox": "^", "node-fetch": "^3.3.2" }, "publishConfig": {