Skip to content

fix: detect @-mentions in type-49 (appmsg) content XML#145

Merged
thisnick merged 1 commit intothisnick:mainfrom
kyan-du:fix/type49-mention-detection
Apr 1, 2026
Merged

fix: detect @-mentions in type-49 (appmsg) content XML#145
thisnick merged 1 commit intothisnick:mainfrom
kyan-du:fix/type49-mention-detection

Conversation

@kyan-du
Copy link
Copy Markdown
Contributor

@kyan-du kyan-du commented Mar 28, 2026

Problem

For reference/quote messages (type=49, i.e. when a user long-presses a message and replies with a quote), WeChat places <atuserlist> inside the content XML column rather than the source column.

The current check_is_mentioned() only inspects the source XML, so @-mentions in quoted replies are silently missed — the message gets buffered but never dispatched.

Fix

After checking the source XML, fall back to checking the content XML for type-49 messages. This ensures quoted replies containing @-mentions are properly detected.

Impact

  • Only affects type-49 (appmsg) messages in group chats
  • No behavior change for normal text messages (type=1) where source XML already works
  • Minimal performance impact: one extra XML tag scan only when source check returns false and message is type-49

Related

Related to #126 — both stem from incomplete handling of type-49 (appmsg) messages. This PR fixes mention detection; #126 covers the broader issue of parsing combined/forwarded message content.

For reference/quote messages (type=49), WeChat may place <atuserlist>
inside the content XML rather than the source column. This caused
@-mentions in quoted replies to be silently missed.

Now falls back to checking content XML for type-49 messages when
source XML has no mention, ensuring quoted replies with @-mentions
are properly detected.

Fixes: group chat replies via quote not triggering bot response
@thisnick thisnick merged commit 5ab79ba into thisnick:main Apr 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants