88 lines
3.2 KiB
JavaScript
88 lines
3.2 KiB
JavaScript
import dingtalkEntry from '@openclaw-china/dingtalk';
|
|
export { DEFAULT_ACCOUNT_ID as DINGTALK_DEFAULT_ACCOUNT_ID, dingtalkPlugin, getDingtalkRuntime, sendMessageDingtalk, setDingtalkRuntime } from '@openclaw-china/dingtalk';
|
|
import feishuEntry from '@openclaw-china/feishu-china';
|
|
export { DEFAULT_ACCOUNT_ID as FEISHU_DEFAULT_ACCOUNT_ID, feishuPlugin, getFeishuRuntime, sendMessageFeishu, setFeishuRuntime } from '@openclaw-china/feishu-china';
|
|
import wecomEntry from '@openclaw-china/wecom';
|
|
export { DEFAULT_ACCOUNT_ID as WECOM_DEFAULT_ACCOUNT_ID, getWecomRuntime, setWecomRuntime, wecomPlugin } from '@openclaw-china/wecom';
|
|
import wecomAppEntry from '@openclaw-china/wecom-app';
|
|
export { DEFAULT_ACCOUNT_ID as WECOM_APP_DEFAULT_ACCOUNT_ID, clearAccessTokenCache, clearAllAccessTokenCache, downloadAndSendImage, getAccessToken, getWecomAppRuntime, sendWecomAppImageMessage, sendWecomAppMarkdownMessage, sendWecomAppMessage, setWecomAppRuntime, stripMarkdown, wecomAppPlugin } from '@openclaw-china/wecom-app';
|
|
import wecomKfEntry from '@openclaw-china/wecom-kf';
|
|
export { DEFAULT_ACCOUNT_ID as WECOM_KF_DEFAULT_ACCOUNT_ID, getWecomKfRuntime, setWecomKfRuntime, wecomKfPlugin } from '@openclaw-china/wecom-kf';
|
|
import qqbotEntry from '@openclaw-china/qqbot';
|
|
export { DEFAULT_ACCOUNT_ID as QQBOT_DEFAULT_ACCOUNT_ID, getQQBotRuntime, qqbotPlugin, setQQBotRuntime } from '@openclaw-china/qqbot';
|
|
import { registerChinaSetupCli, showChinaInstallHint } from '@openclaw-china/shared';
|
|
|
|
// src/index.ts
|
|
var SUPPORTED_CHANNELS = ["dingtalk", "feishu-china", "wecom", "wecom-app", "wecom-kf", "qqbot"];
|
|
var channelPlugins = {
|
|
dingtalk: {
|
|
register: (api) => {
|
|
dingtalkEntry.register(api);
|
|
}
|
|
},
|
|
"feishu-china": {
|
|
register: (api) => {
|
|
feishuEntry.register(api);
|
|
}
|
|
},
|
|
wecom: {
|
|
register: (api) => {
|
|
wecomEntry.register(api);
|
|
}
|
|
},
|
|
"wecom-app": {
|
|
register: (api) => {
|
|
wecomAppEntry.register(api);
|
|
}
|
|
},
|
|
"wecom-kf": {
|
|
register: (api) => {
|
|
wecomKfEntry.register(api);
|
|
}
|
|
},
|
|
qqbot: {
|
|
register: (api) => {
|
|
qqbotEntry.register(api);
|
|
}
|
|
}
|
|
};
|
|
function registerChannelsByConfig(api, cfg) {
|
|
const config = cfg ?? api.config;
|
|
const channelsConfig = config?.channels;
|
|
if (!channelsConfig) {
|
|
return;
|
|
}
|
|
for (const channelId of SUPPORTED_CHANNELS) {
|
|
const channelConfig = channelsConfig[channelId];
|
|
if (!channelConfig?.enabled) {
|
|
continue;
|
|
}
|
|
const plugin = channelPlugins[channelId];
|
|
plugin.register(api);
|
|
}
|
|
}
|
|
var channelsPlugin = {
|
|
id: "channels",
|
|
name: "Moltbot China Channels",
|
|
description: "\u7EDF\u4E00\u6E20\u9053\u5305\uFF0C\u652F\u6301\u9489\u9489\u3001\u98DE\u4E66\u3001\u4F01\u4E1A\u5FAE\u4FE1\u3001QQ Bot",
|
|
configSchema: {
|
|
type: "object",
|
|
additionalProperties: false,
|
|
properties: {}
|
|
},
|
|
/**
|
|
* 注册所有启用的渠道
|
|
*
|
|
* 从 api.config.channels.<id>.enabled 读取配置
|
|
*/
|
|
register(api) {
|
|
registerChinaSetupCli(api, { channels: SUPPORTED_CHANNELS });
|
|
showChinaInstallHint(api);
|
|
registerChannelsByConfig(api);
|
|
}
|
|
};
|
|
var index_default = channelsPlugin;
|
|
|
|
export { SUPPORTED_CHANNELS, index_default as default, registerChannelsByConfig };
|
|
//# sourceMappingURL=index.js.map
|
|
//# sourceMappingURL=index.js.map
|