commandhandler.py 文件源码

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

项目:mobot 作者: JokerQyou 项目源码 文件源码
def check_update(self, update):
        if (isinstance(update, Update)
                and (update.message or update.edited_message and self.allow_edited)):
            message = update.message or update.edited_message

            if message.text:
                command = message.text[1:].split(' ')[0].split('@')
                command.append(
                    message.bot.username)  # in case the command was send without a username

                if self.filters is None:
                    res = True
                elif isinstance(self.filters, list):
                    res = any(func(message) for func in self.filters)
                else:
                    res = self.filters(message)

                return res and (message.text.startswith('/') and command[0] == self.command
                                and command[1].lower() == message.bot.username.lower())
            else:
                return False

        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号