From 014be7bca6f744ec087c1b23ecb37c70ba988f17 Mon Sep 17 00:00:00 2001 From: Suren Khorenyan Date: Sun, 1 Apr 2018 15:33:35 +0300 Subject: [PATCH] Upgraded Message's get_command method to return pure command (backward compatible) --- aiogram/types/message.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aiogram/types/message.py b/aiogram/types/message.py index fe9e87d9..1929f979 100644 --- a/aiogram/types/message.py +++ b/aiogram/types/message.py @@ -130,7 +130,7 @@ class Message(base.TelegramObject): command, _, args = self.text.partition(' ') return command, args - def get_command(self): + def get_command(self, pure=False): """ Get command from message @@ -138,7 +138,10 @@ class Message(base.TelegramObject): """ command = self.get_full_command() if command: - return command[0] + command = command[0] + if pure: + command, _, _ = command[1:].partition('@') + return command def get_args(self): """