From fb4eab734618eb4d817e7fc9d1d51e9768901334 Mon Sep 17 00:00:00 2001 From: Alex Root Junior Date: Sun, 6 Oct 2019 23:17:49 +0300 Subject: [PATCH] Prevent to trigger command filter with non-text messages --- aiogram/dispatcher/filters/builtin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/aiogram/dispatcher/filters/builtin.py b/aiogram/dispatcher/filters/builtin.py index e15b98de..3a47e6fc 100644 --- a/aiogram/dispatcher/filters/builtin.py +++ b/aiogram/dispatcher/filters/builtin.py @@ -79,6 +79,9 @@ class Command(Filter): @staticmethod async def check_command(message: types.Message, commands, prefixes, ignore_case=True, ignore_mention=False): + if not message.text: # Prevent to use with non-text content types + return False + full_command = message.text.split()[0] prefix, (command, _, mention) = full_command[0], full_command[1:].partition('@')