def faq(self, ctx, *, query: str = None):
"""Shows an FAQ entry from the discord.py documentation"""
if not hasattr(self, 'faq_entries'):
await self.refresh_faq_cache()
if query is None:
return await ctx.send('http://discordpy.readthedocs.io/en/latest/faq.html')
matches = fuzzy.extract_matches(query, self.faq_entries, scorer=fuzzy.partial_ratio, score_cutoff=40)
if len(matches) == 0:
return await ctx.send('Nothing found...')
fmt = '\n'.join(f'**{key}**\n{value}' for key, _, value in matches)
await ctx.send(fmt)
评论列表
文章目录