mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 18:01:04 +00:00
Get command and args from message
This commit is contained in:
parent
e3f40c4bee
commit
1759fd9172
1 changed files with 13 additions and 0 deletions
|
|
@ -150,6 +150,19 @@ class Message(Deserializable):
|
|||
def is_command(self):
|
||||
return self.text and self.text.startswith('/')
|
||||
|
||||
def get_full_command(self):
|
||||
if self.is_command():
|
||||
command, _, args = self.text.partition(' ')
|
||||
return command, args
|
||||
|
||||
def get_command(self):
|
||||
command, _ = self.get_command()
|
||||
return command
|
||||
|
||||
def get_args(self):
|
||||
_, args = self.get_command()
|
||||
return args
|
||||
|
||||
async def reply(self, text, parse_mode=None, disable_web_page_preview=None,
|
||||
disable_notification=None, reply_markup=None) -> 'Message':
|
||||
return await self.bot.send_message(self.chat.id, text, parse_mode, disable_web_page_preview,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue