def custom_command_handler(bot: Bot, update: Update):
"""
/msg command. Preserves whitespace. Leaves error handling to the chat.send_message method
:param bot:
:param update:
:return:
"""
if update.message.text.startswith('/msg'):
text = update.message.text[4:].strip()
if text.startswith("@"):
splitter = re.search("\s", text).start()
if splitter is not None:
text = text[splitter:].strip()
splitter = re.search("\s", text).start()
if splitter is None:
args = [text]
else:
args = [text[:splitter].strip(), text[splitter:].strip()]
chat.send_message(bot, update, args)
else:
unknown(bot, update)
评论列表
文章目录