diff --git a/aiogram/types/message.py b/aiogram/types/message.py index 21e2e25e..5eb96618 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -194,8 +194,8 @@ class Message(base.TelegramObject): :return: bool """ - return self.text and self.text.startswith("/") \ - or self.caption and self.caption.startswith("/") + text = self.text or self.caption + return text and text.startswith("/") def get_full_command(self) -> typing.Optional[typing.Tuple[str, str]]: """ @@ -204,8 +204,8 @@ class Message(base.TelegramObject): :return: tuple of (command, args) """ if self.is_command(): - command, *args = (self.text if self.text - else self.caption).split(maxsplit=1) + text = self.text or self.caption + command, *args = text.split(maxsplit=1) args = args[0] if args else "" return command, args