Fix duplicate commands in fuzzy help (#2798)

* Fix duplicate commands in fuzzy help

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Use help command's filter for all fuzzy

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine
2019-06-28 03:31:44 +10:00
committed by Michael H
parent 461f56bca1
commit f3bbfdc64d
3 changed files with 25 additions and 14 deletions

View File

@@ -417,8 +417,9 @@ class RedHelpFormatter:
pages = [box(p) for p in pagify(to_page)]
await self.send_pages(ctx, pages, embed=False)
@staticmethod
async def help_filter_func(
self, ctx, objects: Iterable[SupportsCanSee], bypass_hidden=False
ctx, objects: Iterable[SupportsCanSee], bypass_hidden=False
) -> AsyncIterator[SupportsCanSee]:
"""
This does most of actual filtering.
@@ -450,7 +451,7 @@ class RedHelpFormatter:
"""
Sends an error, fuzzy help, or stays quiet based on settings
"""
coms = [c async for c in self.help_filter_func(ctx, ctx.bot.walk_commands())]
coms = {c async for c in self.help_filter_func(ctx, ctx.bot.walk_commands())}
fuzzy_commands = await fuzzy_command_search(ctx, help_for, commands=coms, min_score=75)
use_embeds = await ctx.embed_requested()
if fuzzy_commands: