mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-22 09:01:46 +03:00
2267d58afc
Replace the built-in Feishu SDK with the community-maintained clawdbot-feishu plugin by @m1heng. Changes: - Remove src/feishu/ directory (19 files) - Remove src/channels/plugins/outbound/feishu.ts - Remove src/channels/plugins/normalize/feishu.ts - Remove src/config/types.feishu.ts - Remove feishu exports from plugin-sdk/index.ts - Remove FeishuConfig from types.channels.ts New features in community plugin: - Document tools (read/create/edit Feishu docs) - Wiki tools (navigate/manage knowledge base) - Drive tools (folder/file management) - Bitable tools (read/write table records) - Permission tools (collaborator management) - Emoji reactions support - Typing indicators - Rich media support (bidirectional image/file transfer) - @mention handling - Skills for feishu-doc, feishu-wiki, feishu-drive, feishu-perm Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import type { ClawdbotConfig } from "openclaw/plugin-sdk";
|
|
import { DEFAULT_ACCOUNT_ID } from "openclaw/plugin-sdk";
|
|
import type { FeishuConfig, FeishuDomain, ResolvedFeishuAccount } from "./types.js";
|
|
|
|
export function resolveFeishuCredentials(cfg?: FeishuConfig): {
|
|
appId: string;
|
|
appSecret: string;
|
|
encryptKey?: string;
|
|
verificationToken?: string;
|
|
domain: FeishuDomain;
|
|
} | null {
|
|
const appId = cfg?.appId?.trim();
|
|
const appSecret = cfg?.appSecret?.trim();
|
|
if (!appId || !appSecret) return null;
|
|
return {
|
|
appId,
|
|
appSecret,
|
|
encryptKey: cfg?.encryptKey?.trim() || undefined,
|
|
verificationToken: cfg?.verificationToken?.trim() || undefined,
|
|
domain: cfg?.domain ?? "feishu",
|
|
};
|
|
}
|
|
|
|
export function resolveFeishuAccount(params: {
|
|
cfg: ClawdbotConfig;
|
|
accountId?: string | null;
|
|
}): ResolvedFeishuAccount {
|
|
const feishuCfg = params.cfg.channels?.feishu as FeishuConfig | undefined;
|
|
const enabled = feishuCfg?.enabled !== false;
|
|
const creds = resolveFeishuCredentials(feishuCfg);
|
|
|
|
return {
|
|
accountId: params.accountId?.trim() || DEFAULT_ACCOUNT_ID,
|
|
enabled,
|
|
configured: Boolean(creds),
|
|
appId: creds?.appId,
|
|
domain: creds?.domain ?? "feishu",
|
|
};
|
|
}
|
|
|
|
export function listFeishuAccountIds(_cfg: ClawdbotConfig): string[] {
|
|
return [DEFAULT_ACCOUNT_ID];
|
|
}
|
|
|
|
export function resolveDefaultFeishuAccountId(_cfg: ClawdbotConfig): string {
|
|
return DEFAULT_ACCOUNT_ID;
|
|
}
|
|
|
|
export function listEnabledFeishuAccounts(cfg: ClawdbotConfig): ResolvedFeishuAccount[] {
|
|
return listFeishuAccountIds(cfg)
|
|
.map((accountId) => resolveFeishuAccount({ cfg, accountId }))
|
|
.filter((account) => account.enabled && account.configured);
|
|
}
|