138 lines
4.9 KiB
TypeScript
138 lines
4.9 KiB
TypeScript
export { DEFAULT_ACCOUNT_ID as DINGTALK_DEFAULT_ACCOUNT_ID, DingtalkConfig, DingtalkSendResult, ResolvedDingtalkAccount, dingtalkPlugin, getDingtalkRuntime, sendMessageDingtalk, setDingtalkRuntime } from '@openclaw-china/dingtalk';
|
|
export { DEFAULT_ACCOUNT_ID as FEISHU_DEFAULT_ACCOUNT_ID, FeishuConfig, FeishuSendResult, ResolvedFeishuAccount, feishuPlugin, getFeishuRuntime, sendMessageFeishu, setFeishuRuntime } from '@openclaw-china/feishu-china';
|
|
export { ResolvedWecomAccount, DEFAULT_ACCOUNT_ID as WECOM_DEFAULT_ACCOUNT_ID, WecomConfig, WecomInboundMessage, getWecomRuntime, setWecomRuntime, wecomPlugin } from '@openclaw-china/wecom';
|
|
export { AccessTokenCacheEntry, ResolvedWecomAppAccount, DEFAULT_ACCOUNT_ID as WECOM_APP_DEFAULT_ACCOUNT_ID, WecomAppConfig, WecomAppDmPolicy, WecomAppInboundMessage, WecomAppSendTarget, clearAccessTokenCache, clearAllAccessTokenCache, downloadAndSendImage, getAccessToken, getWecomAppRuntime, sendWecomAppImageMessage, sendWecomAppMarkdownMessage, sendWecomAppMessage, setWecomAppRuntime, stripMarkdown, wecomAppPlugin } from '@openclaw-china/wecom-app';
|
|
export { ResolvedWecomKfAccount, DEFAULT_ACCOUNT_ID as WECOM_KF_DEFAULT_ACCOUNT_ID, WecomKfAccountConfig, WecomKfConfig, WecomKfDmPolicy, SyncMsgItem as WecomKfSyncMsgItem, SyncMsgResponse as WecomKfSyncMsgResponse, getWecomKfRuntime, setWecomKfRuntime, wecomKfPlugin } from '@openclaw-china/wecom-kf';
|
|
export { DEFAULT_ACCOUNT_ID as QQBOT_DEFAULT_ACCOUNT_ID, QQBotConfig, QQBotSendResult, ResolvedQQBotAccount, getQQBotRuntime, qqbotPlugin, setQQBotRuntime } from '@openclaw-china/qqbot';
|
|
|
|
/**
|
|
* @openclaw-china/channels
|
|
* 统一渠道包入口
|
|
*
|
|
* 导出所有渠道插件,提供统一注册函数
|
|
*
|
|
* Requirements: Unified Package Entry, Unified Distribution
|
|
*/
|
|
|
|
/**
|
|
* 渠道配置接口
|
|
*/
|
|
interface ChannelConfig {
|
|
/** 是否启用该渠道 */
|
|
enabled?: boolean;
|
|
[key: string]: unknown;
|
|
}
|
|
interface WecomRouteConfig extends ChannelConfig {
|
|
webhookPath?: string;
|
|
accounts?: Record<string, {
|
|
webhookPath?: string;
|
|
}>;
|
|
}
|
|
interface WecomAppRouteConfig extends ChannelConfig {
|
|
webhookPath?: string;
|
|
accounts?: Record<string, {
|
|
webhookPath?: string;
|
|
}>;
|
|
}
|
|
interface WecomKfRouteConfig extends ChannelConfig {
|
|
webhookPath?: string;
|
|
accounts?: Record<string, {
|
|
webhookPath?: string;
|
|
}>;
|
|
}
|
|
/**
|
|
* Moltbot 配置接口(符合官方约定)
|
|
* 配置路径: channels.<id>.enabled
|
|
*/
|
|
interface MoltbotConfig {
|
|
channels?: {
|
|
dingtalk?: ChannelConfig;
|
|
"feishu-china"?: ChannelConfig;
|
|
wecom?: WecomRouteConfig;
|
|
"wecom-app"?: WecomAppRouteConfig;
|
|
"wecom-kf"?: WecomKfRouteConfig;
|
|
qqbot?: ChannelConfig;
|
|
qq?: ChannelConfig;
|
|
[key: string]: ChannelConfig | undefined;
|
|
};
|
|
[key: string]: unknown;
|
|
}
|
|
/**
|
|
* Moltbot 插件 API 接口
|
|
*/
|
|
interface MoltbotPluginApi {
|
|
registerChannel: (opts: {
|
|
plugin: unknown;
|
|
}) => void;
|
|
registerCli?: (registrar: (ctx: {
|
|
program: unknown;
|
|
config?: MoltbotConfig;
|
|
}) => void | Promise<void>, opts?: {
|
|
commands?: string[];
|
|
}) => void;
|
|
logger?: {
|
|
info?: (message: string) => void;
|
|
warn?: (message: string) => void;
|
|
error?: (message: string) => void;
|
|
};
|
|
runtime?: {
|
|
config?: {
|
|
writeConfigFile?: (cfg: unknown) => Promise<void>;
|
|
};
|
|
};
|
|
config?: MoltbotConfig;
|
|
[key: string]: unknown;
|
|
}
|
|
/**
|
|
* 支持的渠道列表
|
|
*/
|
|
declare const SUPPORTED_CHANNELS: readonly ["dingtalk", "feishu-china", "wecom", "wecom-app", "wecom-kf", "qqbot"];
|
|
type SupportedChannel = (typeof SUPPORTED_CHANNELS)[number];
|
|
/**
|
|
* 根据 Moltbot 配置注册启用的渠道
|
|
*
|
|
* 符合 Moltbot 官方约定:从 cfg.channels.<id>.enabled 读取配置
|
|
*
|
|
* @param api Moltbot 鎻掍欢 API
|
|
* @param cfg Moltbot 配置(可选,默认从 api.config 读取)
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* // moltbot.json 配置
|
|
* {
|
|
* "channels": {
|
|
* "dingtalk": {
|
|
* "enabled": true,
|
|
* "clientId": "...",
|
|
* "clientSecret": "..."
|
|
* }
|
|
* }
|
|
* }
|
|
* ```
|
|
*/
|
|
declare function registerChannelsByConfig(api: MoltbotPluginApi, cfg?: MoltbotConfig): void;
|
|
/**
|
|
* 统一渠道插件定义
|
|
*
|
|
* 包含所有支持的渠道,通过配置启用
|
|
* 配置路径符合 Moltbot 官方约定: channels.<id>
|
|
*/
|
|
declare const channelsPlugin: {
|
|
id: string;
|
|
name: string;
|
|
description: string;
|
|
configSchema: {
|
|
type: string;
|
|
additionalProperties: boolean;
|
|
properties: {};
|
|
};
|
|
/**
|
|
* 注册所有启用的渠道
|
|
*
|
|
* 从 api.config.channels.<id>.enabled 读取配置
|
|
*/
|
|
register(api: MoltbotPluginApi): void;
|
|
};
|
|
|
|
export { type ChannelConfig, type MoltbotConfig, type MoltbotPluginApi, SUPPORTED_CHANNELS, type SupportedChannel, type WecomAppRouteConfig, type WecomKfRouteConfig, type WecomRouteConfig, channelsPlugin as default, registerChannelsByConfig };
|