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
评论列表
文章目录