Upgraded Message's get_command method to return pure command

(backward compatible)
This commit is contained in:
Suren Khorenyan 2018-04-01 15:33:35 +03:00
parent e756847579
commit 014be7bca6

View file

@ -130,7 +130,7 @@ class Message(base.TelegramObject):
command, _, args = self.text.partition(' ') command, _, args = self.text.partition(' ')
return command, args return command, args
def get_command(self): def get_command(self, pure=False):
""" """
Get command from message Get command from message
@ -138,7 +138,10 @@ class Message(base.TelegramObject):
""" """
command = self.get_full_command() command = self.get_full_command()
if command: if command:
return command[0] command = command[0]
if pure:
command, _, _ = command[1:].partition('@')
return command
def get_args(self): def get_args(self):
""" """