[V3] Start work on fuzzy command search (#1600)

* [V3] Start work on fuzzy command search

* Implement in command error handler

* Something isn't working here, try fixing

* Style compliance

* Add fuzzywuzzy to pipfile

* Dump the short doc part if there is no short doc

* Add fuzzy command search on command not found in help

* Move things around, implement for use of default d.py help formatter

* Formatting compliance

* Undo pipfile changes
This commit is contained in:
palmtree5
2018-05-27 18:57:10 -08:00
committed by Kowlin
parent 4028dd3009
commit 4f270f3aab
5 changed files with 39 additions and 11 deletions

View File

@@ -15,7 +15,8 @@ from discord.ext import commands
from . import __version__
from .data_manager import storage_type
from .utils.chat_formatting import inline, bordered
from .utils.chat_formatting import inline, bordered, pagify, box
from .utils import fuzzy_command_search
from colorama import Fore, Style, init
log = logging.getLogger("red")
@@ -221,7 +222,10 @@ def init_events(bot, cli_flags):
if not hasattr(ctx.cog, "_{0.command.cog_name}__error".format(ctx)):
await ctx.send(inline(message))
elif isinstance(error, commands.CommandNotFound):
pass
term = ctx.invoked_with + " "
if len(ctx.args) > 1:
term += " ".join(ctx.args[1:])
await ctx.maybe_send_embed(fuzzy_command_search(ctx, ctx.invoked_with))
elif isinstance(error, commands.CheckFailure):
await ctx.send("⛔ You are not authorized to issue that command.")
elif isinstance(error, commands.NoPrivateMessage):