@chbo297/infoflow 2026.3.9 → 2026.3.10
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/bot.ts +14 -3
package/package.json
CHANGED
package/src/bot.ts
CHANGED
|
@@ -373,11 +373,15 @@ export async function handlePrivateChatMessage(params: HandlePrivateChatParams):
|
|
|
373
373
|
export async function handleGroupChatMessage(params: HandleGroupChatParams): Promise<void> {
|
|
374
374
|
const { cfg, msgData, accountId, statusSink } = params;
|
|
375
375
|
|
|
376
|
-
// Extract sender from nested structure or flat fields
|
|
376
|
+
// Extract sender from nested structure or flat fields.
|
|
377
|
+
// Some Infoflow events (including bot-authored forwards) only populate `fromid` on the root,
|
|
378
|
+
// so include msgData.fromid as a final fallback.
|
|
377
379
|
const header = (msgData.message as Record<string, unknown>)?.header as
|
|
378
380
|
| Record<string, unknown>
|
|
379
381
|
| undefined;
|
|
380
|
-
const fromuser = String(
|
|
382
|
+
const fromuser = String(
|
|
383
|
+
header?.fromuserid ?? msgData.fromuserid ?? msgData.from ?? msgData.fromid ?? "",
|
|
384
|
+
);
|
|
381
385
|
|
|
382
386
|
// Extract message ID (priority: header.messageid > header.msgid > MsgId)
|
|
383
387
|
const messageId = header?.messageid ?? header?.msgid ?? msgData.MsgId;
|
|
@@ -426,7 +430,7 @@ export async function handleGroupChatMessage(params: HandleGroupChatParams): Pro
|
|
|
426
430
|
if (replyBody) {
|
|
427
431
|
replyContextItems.push(replyBody);
|
|
428
432
|
}
|
|
429
|
-
} else if (item.type === "TEXT") {
|
|
433
|
+
} else if (item.type === "TEXT" || item.type === "MD") {
|
|
430
434
|
textContent += item.content ?? "";
|
|
431
435
|
rawTextContent += item.content ?? "";
|
|
432
436
|
} else if (item.type === "LINK") {
|
|
@@ -447,6 +451,10 @@ export async function handleGroupChatMessage(params: HandleGroupChatParams): Pro
|
|
|
447
451
|
if (typeof url === "string" && url.trim()) {
|
|
448
452
|
imageUrls.push(url.trim());
|
|
449
453
|
}
|
|
454
|
+
} else if (typeof item.content === "string" && item.content.trim()) {
|
|
455
|
+
// Fallback: for any other item types with string content, treat content as text.
|
|
456
|
+
textContent += item.content;
|
|
457
|
+
rawTextContent += item.content;
|
|
450
458
|
}
|
|
451
459
|
}
|
|
452
460
|
}
|
|
@@ -904,3 +912,6 @@ export const _checkWatchMentioned = checkWatchMentioned;
|
|
|
904
912
|
|
|
905
913
|
/** @internal — Extract non-bot mention IDs. Only exported for tests. */
|
|
906
914
|
export const _extractMentionIds = extractMentionIds;
|
|
915
|
+
|
|
916
|
+
/** @internal — Check watchRegex against message content (dotAll). Only exported for tests. */
|
|
917
|
+
export const _checkWatchRegex = checkWatchRegex;
|