Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from bundle
Use when building or fixing aiogram 3 bots that need aiogram_i18n with Fluent/FTL, topic-aware reply handling, Telegram quote and forward-origin context, and pr
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/replies-and-topics.md
1# Replies and Topics23`message.reply_to_message` is not enough for production reply logic.45## Valid reply semantics67In forum-enabled chats, replying to the topic starter is often not a meaningful reply target for command logic.89A practical rule:10- if there is no `reply_to_message`, it is not a reply11- outside forum topics, any reply is valid12- inside forum topics, ignore replies where `reply_to_message.message_id == message.message_thread_id`1314Use `scripts/topic_aware_reply_helpers.py`.1516## Thread id normalization1718`message_thread_id` needs normalization because Telegram uses it in several different ways:19- real forum topics20- private-message topics21- linked discussion groups for channel comments22- pseudo-thread ids in non-forum chats when replying to a bot2324Useful rules:25- in forum chats, only return `message_thread_id` for real topic messages26- in linked discussion groups, keep `message_thread_id` only when it represents a real discussion thread27- ignore pseudo-thread ids created by bot replies in plain chats28- when needed, prefer the current message thread and fallback to the replied message thread2930## Reply filters3132For routers, keep reusable reply filter expressions rather than repeating raw `F.reply_to_message` checks everywhere.3334Two useful variants:35- `IS_REPLY`: true only for meaningful replies36- `FILTER_REPLY_OR_NONE`: allow no reply or a topic-root reply, but exclude arbitrary reply-to-user cases37