mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
commit
83df269730
@ -191,6 +191,7 @@ def is_command(text):
|
||||
:param text: Text to check.
|
||||
:return: True if `text` is a command, else False.
|
||||
"""
|
||||
if (text is None): return None
|
||||
return text.startswith('/')
|
||||
|
||||
|
||||
@ -208,6 +209,7 @@ def extract_command(text):
|
||||
:param text: String to extract the command from
|
||||
:return: the command if `text` is a command (according to is_command), else None.
|
||||
"""
|
||||
if (text is None): return None
|
||||
return text.split()[0].split('@')[0][1:] if is_command(text) else None
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user