fix: slash commands now respect require_mention in Telegram groups
When require_mention is enabled, slash commands no longer bypass mention checks. Bare /command without @mention is filtered in groups, while /command@botname (bot menu) and @botname /command still pass. Commands still pass unconditionally when require_mention is disabled, preserving backward compatibility. Closes #6033
This commit is contained in:
@@ -71,7 +71,13 @@ def test_group_messages_can_require_direct_trigger_via_config():
|
||||
assert adapter._should_process_message(_group_message("hello everyone")) is False
|
||||
assert adapter._should_process_message(_group_message("hi @hermes_bot", entities=[_mention_entity("hi @hermes_bot")])) is True
|
||||
assert adapter._should_process_message(_group_message("replying", reply_to_bot=True)) is True
|
||||
assert adapter._should_process_message(_group_message("/status"), is_command=True) is True
|
||||
# Commands must also respect require_mention when it is enabled
|
||||
assert adapter._should_process_message(_group_message("/status"), is_command=True) is False
|
||||
# But commands with @mention still pass
|
||||
assert adapter._should_process_message(_group_message("/status@hermes_bot")) is True
|
||||
# And commands still pass unconditionally when require_mention is disabled
|
||||
adapter_no_mention = _make_adapter(require_mention=False)
|
||||
assert adapter_no_mention._should_process_message(_group_message("/status"), is_command=True) is True
|
||||
|
||||
|
||||
def test_free_response_chats_bypass_mention_requirement():
|
||||
|
||||
Reference in New Issue
Block a user