mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
fix get_full_command (#348)
The reason is that .partition() doesn't have a default param as .split has, and default split param gives possibility to split not only by whitespaces, but also whitespace consequences (so the .strip() in get_args() not needed) and newlines.
It's called "fix", because without it, commands like this:
'''/command
arg
arg1'''
are resulting with ('/command\narg\narg1', '', '')
This commit is contained in:
parent
50b5768759
commit
027139f1b2
1 changed files with 2 additions and 2 deletions
|
|
@ -168,7 +168,7 @@ class Message(base.TelegramObject):
|
|||
:return: tuple of (command, args)
|
||||
"""
|
||||
if self.is_command():
|
||||
command, _, args = self.text.partition(' ')
|
||||
command, args = self.text.split(maxsplit=1)
|
||||
return command, args
|
||||
|
||||
def get_command(self, pure=False):
|
||||
|
|
@ -192,7 +192,7 @@ class Message(base.TelegramObject):
|
|||
"""
|
||||
command = self.get_full_command()
|
||||
if command:
|
||||
return command[1].strip()
|
||||
return command[1]
|
||||
|
||||
def parse_entities(self, as_html=True):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue