@milerliu/feishu 0.1.15 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/send.ts +27 -5
package/package.json
CHANGED
package/src/send.ts
CHANGED
|
@@ -309,19 +309,38 @@ export async function sendCardFeishu(params: SendFeishuCardParams): Promise<Feis
|
|
|
309
309
|
}
|
|
310
310
|
|
|
311
311
|
const receiveIdType = resolveReceiveIdType(receiveId);
|
|
312
|
-
|
|
312
|
+
|
|
313
|
+
// Extract content from card for post message
|
|
314
|
+
const markdownContent = card.elements?.[0]?.content || "";
|
|
315
|
+
|
|
316
|
+
// Build post-type rich text message
|
|
317
|
+
const postContent = {
|
|
318
|
+
zh_cn: {
|
|
319
|
+
title: "AI 回复",
|
|
320
|
+
content: [
|
|
321
|
+
[
|
|
322
|
+
{
|
|
323
|
+
tag: "text",
|
|
324
|
+
text: markdownContent,
|
|
325
|
+
},
|
|
326
|
+
],
|
|
327
|
+
],
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
const content = JSON.stringify(postContent);
|
|
313
332
|
|
|
314
333
|
if (replyToMessageId) {
|
|
315
334
|
const response = await client.im.message.reply({
|
|
316
335
|
path: { message_id: replyToMessageId },
|
|
317
336
|
data: {
|
|
318
337
|
content,
|
|
319
|
-
msg_type: "
|
|
338
|
+
msg_type: "post",
|
|
320
339
|
},
|
|
321
340
|
});
|
|
322
341
|
|
|
323
342
|
if (response.code !== 0) {
|
|
324
|
-
throw new Error(`Feishu
|
|
343
|
+
throw new Error(`Feishu post reply failed: ${response.msg || `code ${response.code}`}`);
|
|
325
344
|
}
|
|
326
345
|
|
|
327
346
|
return {
|
|
@@ -335,12 +354,12 @@ export async function sendCardFeishu(params: SendFeishuCardParams): Promise<Feis
|
|
|
335
354
|
data: {
|
|
336
355
|
receive_id: receiveId,
|
|
337
356
|
content,
|
|
338
|
-
msg_type: "
|
|
357
|
+
msg_type: "post",
|
|
339
358
|
},
|
|
340
359
|
});
|
|
341
360
|
|
|
342
361
|
if (response.code !== 0) {
|
|
343
|
-
throw new Error(`Feishu
|
|
362
|
+
throw new Error(`Feishu post send failed: ${response.msg || `code ${response.code}`}`);
|
|
344
363
|
}
|
|
345
364
|
|
|
346
365
|
return {
|
|
@@ -382,11 +401,14 @@ export function buildMarkdownCard(text: string): Record<string, unknown> {
|
|
|
382
401
|
type: "adaptive",
|
|
383
402
|
config: {
|
|
384
403
|
wide_screen_mode: true,
|
|
404
|
+
enable_forward: true,
|
|
385
405
|
},
|
|
386
406
|
elements: [
|
|
387
407
|
{
|
|
388
408
|
tag: "markdown",
|
|
389
409
|
content: text,
|
|
410
|
+
text_align: "left",
|
|
411
|
+
text_size: "normal",
|
|
390
412
|
},
|
|
391
413
|
],
|
|
392
414
|
};
|