mirror of
https://github.com/PHIDIAS0303/ClusterChatSync.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -3,7 +3,7 @@ const Discord = require('discord.js');
|
|||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
const {BaseControllerPlugin} = require('@clusterio/controller');
|
const {BaseControllerPlugin} = require('@clusterio/controller');
|
||||||
const {InstanceActionEvent} = require('./info.js');
|
const {InstanceActionEvent} = require('./info.js');
|
||||||
import { ChatEvent } from "./messages";
|
import { ChatEvent } from "./message.js";
|
||||||
|
|
||||||
const MAX_DISCORD_MESSAGE_LENGTH = 1950;
|
const MAX_DISCORD_MESSAGE_LENGTH = 1950;
|
||||||
const MIN_CONFIDENCE_SCORE = 10.0;
|
const MIN_CONFIDENCE_SCORE = 10.0;
|
||||||
|
|||||||
@@ -1,24 +1,31 @@
|
|||||||
import { Type, Static } from "@sinclair/typebox";
|
import { Type, Static } from "@sinclair/typebox";
|
||||||
export class ChatEvent {
|
export class ChatEvent {
|
||||||
declare ["constructor"]: typeof ChatEvent;
|
// declare ["constructor"]: typeof ChatEvent;
|
||||||
static type = "event" as const;
|
// as const
|
||||||
static src = ["control", "instance"] as const;
|
static type = "event";
|
||||||
static dst = "instance" as const;
|
// as const
|
||||||
static plugin = "global_chat" as const;
|
static src = ["control", "instance"];
|
||||||
|
// as const
|
||||||
|
static dst = "instance";
|
||||||
|
// as const
|
||||||
|
static plugin = "global_chat";
|
||||||
static permission = null;
|
static permission = null;
|
||||||
|
|
||||||
|
/*
|
||||||
constructor(
|
constructor(
|
||||||
public instanceName: string,
|
public instanceName: string,
|
||||||
public content: string,
|
public content: string,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
static jsonSchema = Type.Object({
|
static jsonSchema = Type.Object({
|
||||||
"instanceName": Type.String(),
|
"instanceName": Type.String(),
|
||||||
"content": Type.String(),
|
"content": Type.String(),
|
||||||
});
|
});
|
||||||
|
|
||||||
static fromJSON(json: Static<typeof ChatEvent.jsonSchema>) {
|
// json: Static<typeof ChatEvent.jsonSchema>
|
||||||
|
static fromJSON(json) {
|
||||||
return new this(json.instanceName, json.content);
|
return new this(json.instanceName, json.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,6 +36,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.19.3",
|
"discord.js": "^14.19.3",
|
||||||
|
"@sinclair/typebox": "^",
|
||||||
"node-fetch": "^3.3.2"
|
"node-fetch": "^3.3.2"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
|||||||
Reference in New Issue
Block a user