Optimize config calls in few places (#3766)

* Just a tiny PR improving config call in a lot of places (Specially events and Help)

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* missed this one

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* welp

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

* Update redbot/cogs/mod/kickban.py

Co-Authored-By: jack1142 <6032823+jack1142@users.noreply.github.com>

* jack

Signed-off-by: Drapersniper <27962761+drapersniper@users.noreply.github.com>

Co-authored-by: jack1142 <6032823+jack1142@users.noreply.github.com>
This commit is contained in:
Draper
2020-04-20 18:29:36 +01:00
committed by GitHub
parent e4018ec677
commit f59e77002b
7 changed files with 153 additions and 116 deletions

View File

@@ -13,7 +13,7 @@ import pkg_resources
from colorama import Fore, Style, init
from pkg_resources import DistributionNotFound
from redbot.core.commands import RedHelpFormatter
from redbot.core.commands import RedHelpFormatter, HelpSettings
from redbot.core.i18n import Translator
from .. import __version__ as red_version, version_info as red_version_info, VersionInfo
from . import commands
@@ -192,10 +192,14 @@ def init_events(bot, cli_flags):
bot._last_exception = exception_log
await ctx.send(inline(message))
elif isinstance(error, commands.CommandNotFound):
help_settings = await HelpSettings.from_context(ctx)
fuzzy_commands = await fuzzy_command_search(
ctx,
commands={
c async for c in RedHelpFormatter.help_filter_func(ctx, bot.walk_commands())
c
async for c in RedHelpFormatter.help_filter_func(
ctx, bot.walk_commands(), help_settings=help_settings
)
},
)
if not fuzzy_commands: