feat(feishu): sync with clawdbot-feishu #137 (multi-account support)

- Sync latest changes from clawdbot-feishu including multi-account support
- Add eslint-disable comments for SDK-related any types
- Remove unused imports
- Fix no-floating-promises in monitor.ts

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Yifeng Wang
2026-02-05 19:18:25 +08:00
committed by cpojer
parent 7e005acd3c
commit 5f6e1c19bd
22 changed files with 785 additions and 369 deletions

View File

@@ -1,5 +1,5 @@
import type { ClawdbotConfig } from "openclaw/plugin-sdk";
import type { FeishuConfig } from "./types.js";
import { resolveFeishuAccount } from "./accounts.js";
import { createFeishuClient } from "./client.js";
// Feishu emoji types for typing indicator
@@ -18,14 +18,15 @@ export type TypingIndicatorState = {
export async function addTypingIndicator(params: {
cfg: ClawdbotConfig;
messageId: string;
accountId?: string;
}): Promise<TypingIndicatorState> {
const { cfg, messageId } = params;
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
if (!feishuCfg) {
const { cfg, messageId, accountId } = params;
const account = resolveFeishuAccount({ cfg, accountId });
if (!account.configured) {
return { messageId, reactionId: null };
}
const client = createFeishuClient(feishuCfg);
const client = createFeishuClient(account);
try {
const response = await client.im.messageReaction.create({
@@ -51,18 +52,19 @@ export async function addTypingIndicator(params: {
export async function removeTypingIndicator(params: {
cfg: ClawdbotConfig;
state: TypingIndicatorState;
accountId?: string;
}): Promise<void> {
const { cfg, state } = params;
const { cfg, state, accountId } = params;
if (!state.reactionId) {
return;
}
const feishuCfg = cfg.channels?.feishu as FeishuConfig | undefined;
if (!feishuCfg) {
const account = resolveFeishuAccount({ cfg, accountId });
if (!account.configured) {
return;
}
const client = createFeishuClient(feishuCfg);
const client = createFeishuClient(account);
try {
await client.im.messageReaction.delete({