mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-23 03:08:01 -05:00
[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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user