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