Skip to content

feat: store reply_to_msg_id and reply_to_top_id for forum topic support#3

Open
jgalea wants to merge 2 commits intopublic-clis:mainfrom
jgalea:feature/reply-to-fields
Open

feat: store reply_to_msg_id and reply_to_top_id for forum topic support#3
jgalea wants to merge 2 commits intopublic-clis:mainfrom
jgalea:feature/reply-to-fields

Conversation

@jgalea
Copy link
Contributor

@jgalea jgalea commented Mar 22, 2026

Summary

  • Adds reply_to_msg_id and reply_to_top_id columns to the messages table
  • reply_to_msg_id: the specific message being replied to
  • reply_to_top_id: the forum topic root message ID (essential for grouping messages by topic in supergroups)
  • Both fields are captured during fetch_history and listen operations
  • Includes automatic schema migration for existing databases (safe ALTER TABLE ADD COLUMN with error suppression for idempotency)
  • Both fields are included in JSON/YAML output from all query commands

Use case

Forum-style Telegram supergroups use topics. Without reply_to_top_id, there's no way to know which topic a message belongs to from the local database. This makes it possible to group and filter messages by forum topic.

Test plan

  • Verified migration runs on existing database without data loss
  • Verified reply_to_top_id correctly maps to forum topic IDs
  • Verified reply_to_msg_id captures direct reply targets
  • Verified both fields appear in --json output
  • Verified re-running migration is idempotent (no errors on second run)

jgalea and others added 2 commits March 22, 2026 11:54
Adds two new columns to the messages table:
- reply_to_msg_id: the message being replied to
- reply_to_top_id: the forum topic root message ID

This enables grouping messages by forum topic in supergroups,
which is essential for summarizing conversations by category.

Includes automatic schema migration for existing databases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Enables sending to specific forum topics and suppressing link previews.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant