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

Two None checks

This commit is contained in:
Badiboy 2020-08-19 23:57:48 +03:00
parent 19aaf83d88
commit 18eb8eb605

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