bot.py 文件源码

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

项目:Siarobo 作者: siyanew 项目源码 文件源码
def on_inline_query(message):
    query_id, from_id, query = telepot.glance(message, flavor='inline_query')
    global plugins

    @asyncio.coroutine
    def get_inline():
        for plugin in plugins:
            if 'inline_query' in plugin:
                for pattern in plugin['inline_patterns']:
                    if re.search(pattern, query, re.IGNORECASE|re.MULTILINE):
                        matches = re.findall(pattern, query, re.IGNORECASE)
                        return_values = yield from plugin['inline_query'](message, matches[0], from_id, 0)
                        if return_values:
                            return {'results': return_values, 'cache_time': 0}
                        break
        return []
    try:
        answerer.answer(message, get_inline)

    except:
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号