mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix get_full_command for messages with caption
This commit is contained in:
parent
d5a4c0c4af
commit
1ae3d2e189
1 changed files with 7 additions and 5 deletions
|
|
@ -194,7 +194,8 @@ class Message(base.TelegramObject):
|
||||||
|
|
||||||
:return: bool
|
:return: bool
|
||||||
"""
|
"""
|
||||||
return self.text and self.text.startswith("/")
|
return self.text and self.text.startswith("/") \
|
||||||
|
or self.caption and self.caption.startswith("/")
|
||||||
|
|
||||||
def get_full_command(self) -> typing.Optional[typing.Tuple[str, str]]:
|
def get_full_command(self) -> typing.Optional[typing.Tuple[str, str]]:
|
||||||
"""
|
"""
|
||||||
|
|
@ -203,8 +204,9 @@ class Message(base.TelegramObject):
|
||||||
:return: tuple of (command, args)
|
:return: tuple of (command, args)
|
||||||
"""
|
"""
|
||||||
if self.is_command():
|
if self.is_command():
|
||||||
command, *args = self.text.split(maxsplit=1)
|
command, *args = (self.text if self.text
|
||||||
args = args[-1] if args else ""
|
else self.caption).split(maxsplit=1)
|
||||||
|
args = args[0] if args else ""
|
||||||
return command, args
|
return command, args
|
||||||
|
|
||||||
def get_command(self, pure=False) -> typing.Optional[str]:
|
def get_command(self, pure=False) -> typing.Optional[str]:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue