Skip to content

fix fix-telegram-group-replies

Klaus Wölfel requested to merge fix-telegram-group-replies into master

The bot was silently ignoring group messages because:

  1. Mention detection only checked plain-text "@botname" but Telegram often sends mentions as entities (MENTION / TEXT_MENTION) when users autocomplete the bot name — these were missed.
  2. No logging at all — impossible to diagnose why the bot was silent.

Changes:

  • Extract _is_bot_mentioned() helper that checks both plain text and Telegram message entities (MENTION and TEXT_MENTION types), with case-insensitive username comparison.
  • Add debug/info logging throughout _on_message: chat ID, chat type, allowed-chat filtering, mention/reply detection results.
  • Log allowed-chats configuration at startup.
  • Import MessageEntityType from telegram.constants.
  • Add comprehensive tests for _is_bot_mentioned.

Merge request reports