fix: 统一 pluginId 为 zhidui-channel
- 修改 package.json pluginId: pit-bot -> zhidui-channel - 修改 channel.ts 中的 id 为 zhidui-channel - 重命名目录为 openclaw-zhidui-channel
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
/**
|
||||
* PIT Channel 主文件
|
||||
* @module channel
|
||||
* PIT Channel 主文� * @module channel
|
||||
*/
|
||||
|
||||
import type {
|
||||
@@ -33,7 +32,7 @@ import { chunkText } from "./utils/chunker.js";
|
||||
import { createLogger } from "./utils/logger.js";
|
||||
import { registerWebUIRoutes } from "./webui/routes.js";
|
||||
|
||||
const MODULE = "pit-bot";
|
||||
const MODULE = "zhidui-channel";
|
||||
|
||||
// Gateway å®žä¾‹æ˜ å°„
|
||||
const gateways = new Map<string, Gateway>();
|
||||
@@ -42,10 +41,10 @@ const gateways = new Map<string, Gateway>();
|
||||
* PIT Bot Channel Plugin
|
||||
*/
|
||||
export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
id: "pit-bot",
|
||||
id: "zhidui-channel",
|
||||
|
||||
meta: {
|
||||
id: "pit-bot",
|
||||
id: "zhidui-channel",
|
||||
label: "PIT Bot",
|
||||
selectionLabel: "PIT Bot",
|
||||
docsPath: "/docs/channels/pit-bot",
|
||||
@@ -121,7 +120,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const gateway = gateways.get(accountId);
|
||||
if (!gateway) {
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: "",
|
||||
error: new Error(`Gateway not available for account ${accountId}`),
|
||||
};
|
||||
@@ -130,7 +129,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const result = await gateway.sendText(to, text, replyToId);
|
||||
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: result.messageId ?? "",
|
||||
error: result.error ? new Error(result.error) : undefined,
|
||||
};
|
||||
@@ -138,7 +137,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
log.error("sendText failed", { to, accountId, error: message });
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: "",
|
||||
error: new Error(message),
|
||||
};
|
||||
@@ -152,7 +151,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const gateway = gateways.get(accountId);
|
||||
if (!gateway) {
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: "",
|
||||
error: new Error(`Gateway not available for account ${accountId}`),
|
||||
};
|
||||
@@ -161,7 +160,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const result = await gateway.sendMedia(to, mediaUrl ?? "", text, replyToId);
|
||||
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: result.messageId ?? "",
|
||||
error: result.error ? new Error(result.error) : undefined,
|
||||
};
|
||||
@@ -169,7 +168,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
log.error("sendMedia failed", { to, accountId, error: message });
|
||||
return {
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
messageId: "",
|
||||
error: new Error(message),
|
||||
};
|
||||
@@ -205,7 +204,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
getStatus: () => ctx.getStatus(),
|
||||
onMessage: (message: PITUserMessage) => {
|
||||
ctx.emitMessage({
|
||||
channel: "pit-bot",
|
||||
channel: "zhidui-channel",
|
||||
accountId: account.accountId,
|
||||
chatId: `pit-bot:user:${message.userId}`,
|
||||
chatType: "direct",
|
||||
@@ -310,8 +309,7 @@ export const pitBotPlugin: ChannelPlugin<ResolvedPITBotAccount> = {
|
||||
},
|
||||
} as ChannelStatusAdapter,
|
||||
|
||||
// 初始化钩子
|
||||
init: async (api: unknown) => {
|
||||
// åˆ<EFBFBD>始化钩å? init: async (api: unknown) => {
|
||||
const log = createLogger(MODULE);
|
||||
log.info("PIT Bot plugin initializing");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user