Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
style(channel): 统一代码中的引号格式并调整缩进
  • Loading branch information
chenxiaoyufisher-hash committed Apr 9, 2026
commit db0d392567f316d063fe78ae4e1eb1acf968e6a6
118 changes: 59 additions & 59 deletions src/channel/interactive-dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export async function dispatchFeishuPluginInteractiveHandler(params: {
const ctx: any = {
channel: 'slack',
accountId: params.accountId,
conversationId: basics.openChatId || "",
conversationId: basics.openChatId || '',
senderId: basics.senderOpenId,
auth: {
isAuthorizedSender: true,
Expand All @@ -119,79 +119,79 @@ export async function dispatchFeishuPluginInteractiveHandler(params: {
};

const respond = {
acknowledge: async () => {},
reply: async (args: { text: string }) => {
if (!basics.openChatId || !String(args?.text || '').trim()) return;
await sendMessageFeishu({
cfg: params.cfg,
to: basics.openChatId,
text: String(args?.text || ''),
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
},
followUp: async (args: { text: string }) => {
if (!basics.openChatId || !String(args?.text || '').trim()) return;
await sendMessageFeishu({
cfg: params.cfg,
to: basics.openChatId,
text: String(args?.text || ''),
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
},
editMessage: async (args: { text?: string; blocks?: unknown[] }) => {
if (!basics.openMessageId) {
if (Array.isArray(args?.blocks) && args.blocks.length && basics.openChatId) {
await sendCardFeishu({
cfg: params.cfg,
to: basics.openChatId,
card: { schema: '2.0', body: { elements: args.blocks as Record<string, unknown>[] } },
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
return;
}
if (typeof args?.text === 'string' && args.text.trim() && basics.openChatId) {
await sendMessageFeishu({
cfg: params.cfg,
to: basics.openChatId,
text: args.text,
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
}
return;
}
if (Array.isArray(args?.blocks) && args.blocks.length) {
await updateCardFeishu({
acknowledge: async () => {},
reply: async (args: { text: string }) => {
if (!basics.openChatId || !String(args?.text || '').trim()) return;
await sendMessageFeishu({
cfg: params.cfg,
to: basics.openChatId,
text: String(args?.text || ''),
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
},
followUp: async (args: { text: string }) => {
if (!basics.openChatId || !String(args?.text || '').trim()) return;
await sendMessageFeishu({
cfg: params.cfg,
to: basics.openChatId,
text: String(args?.text || ''),
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
},
editMessage: async (args: { text?: string; blocks?: unknown[] }) => {
if (!basics.openMessageId) {
if (Array.isArray(args?.blocks) && args.blocks.length && basics.openChatId) {
await sendCardFeishu({
cfg: params.cfg,
messageId: basics.openMessageId,
to: basics.openChatId,
card: { schema: '2.0', body: { elements: args.blocks as Record<string, unknown>[] } },
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
return;
}
if (typeof args?.text === 'string' && args.text.trim()) {
await updateCardFeishu({
if (typeof args?.text === 'string' && args.text.trim() && basics.openChatId) {
await sendMessageFeishu({
cfg: params.cfg,
messageId: basics.openMessageId,
card: buildMarkdownCard(args.text),
to: basics.openChatId,
text: args.text,
replyToMessageId: basics.openMessageId,
accountId: params.accountId,
replyInThread: false,
});
return;
}
return;
}
if (Array.isArray(args?.blocks) && args.blocks.length) {
await updateCardFeishu({
cfg: params.cfg,
messageId: basics.openMessageId,
card: { schema: '2.0', body: { elements: [] } },
card: { schema: '2.0', body: { elements: args.blocks as Record<string, unknown>[] } },
accountId: params.accountId,
});
},
return;
}
if (typeof args?.text === 'string' && args.text.trim()) {
await updateCardFeishu({
cfg: params.cfg,
messageId: basics.openMessageId,
card: buildMarkdownCard(args.text),
accountId: params.accountId,
});
return;
}
await updateCardFeishu({
cfg: params.cfg,
messageId: basics.openMessageId,
card: { schema: '2.0', body: { elements: [] } },
accountId: params.accountId,
});
},
};

try {
Expand Down