Bot.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:tinder-telegram-bot 作者: arthurdk 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号