ductor icon indicating copy to clipboard operation
ductor copied to clipboard

Media messages bypass group_mention_only setting

Open alexeymorozua opened this issue 8 months ago • 1 comments

Bug

When group_mention_only: true is set in config, text messages correctly require a bot mention in groups. However, media messages (photos, videos, documents) are processed unconditionally — the group_mention_only check is missing.

Root cause

In messenger/telegram/app.py, the media handling block checks is_media_addressed() but does not check self._config.group_mention_only first:

if has_media(message):
    if is_group and not is_media_addressed(message, self._bot_id, self._bot_username):
        return None

This means media is always filtered by is_media_addressed in groups, even when group_mention_only is false (bot should react to everything).

The logic should be:

if has_media(message):
    if (
        is_group
        and self._config.group_mention_only
        and not is_media_addressed(message, self._bot_id, self._bot_username)
    ):
        return None

Expected behavior

  • group_mention_only: true → media requires mention (current behavior)
  • group_mention_only: false → media is always processed (currently broken — still requires mention)

alexeymorozua avatar Mar 12 '26 21:03 alexeymorozua

Fixed in v0.15.0. I updated _resolve_text() so media messages in groups check group_mention_only before filtering. When group_mention_only=false, media is always processed. Also added rejection of media addressed to other bots.

PleasePrompto avatar Mar 14 '26 13:03 PleasePrompto