mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
change to more cleaner method
This commit is contained in:
parent
1ae3d2e189
commit
f790819369
1 changed files with 4 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue