消息
Some checks failed
test / Run tests (push) Failing after 6s
build / Build (push) Failing after 18s

This commit is contained in:
2025-02-06 17:34:55 +08:00
parent 65b231911e
commit 116f614852
18 changed files with 182 additions and 157 deletions

View File

@ -1,9 +1,10 @@
import LoggerCore from "@App/app/logger/core";
import { Message, MessageConnect } from "./server";
import { Message, MessageConnect, MessageSend } from "./server";
import { ExtensionMessageSend } from "./extension_message";
export async function sendMessage(msg: Message, action: string, data?: any): Promise<any> {
export async function sendMessage(msg: MessageSend, action: string, data?: any): Promise<any> {
const res = await msg.sendMessage({ action, data });
LoggerCore.getInstance().logger().debug("sendMessage", { action, data, response: res });
LoggerCore.getInstance().logger().trace("sendMessage", { action, data, response: res });
if (res && res.code) {
console.error(res);
return Promise.reject(res.message);
@ -18,7 +19,7 @@ export function connect(msg: Message, action: string, data?: any): Promise<Messa
export class Client {
constructor(
private msg: Message,
private msg: ExtensionMessageSend,
private prefix: string
) {
if (!this.prefix.endsWith("/")) {