1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Merge pull request #953 from Badiboy/master

Two None checks
This commit is contained in:
Badiboy 2020-08-20 00:00:57 +03:00 committed by GitHub
commit 83df269730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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