diff options
author | 2021-03-13 17:43:55 +0200 | |
---|---|---|
committer | 2021-03-13 17:43:55 +0200 | |
commit | 0f69e00aa55ca7294e71e19ab41b57bef7a9f977 (patch) | |
tree | 7deaf95949693aafc7592dfe7933425ebdc8f6dc /bot/utils | |
parent | Merge pull request #619 from JagTheFriend/master (diff) | |
parent | make invoke_help_command only take ctx (diff) |
Merge pull request #625 from ToxicKidz/no-ctx-send-help
change ctx.send_help to ctx.invoke(help_command)
Diffstat (limited to 'bot/utils')
-rw-r--r-- | bot/utils/extensions.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bot/utils/extensions.py b/bot/utils/extensions.py index 50350ea8..459588a1 100644 --- a/bot/utils/extensions.py +++ b/bot/utils/extensions.py @@ -3,6 +3,8 @@ import inspect import pkgutil from typing import Iterator, NoReturn +from discord.ext.commands import Context + from bot import exts @@ -31,4 +33,12 @@ def walk_extensions() -> Iterator[str]: yield module.name +async def invoke_help_command(ctx: Context) -> None: + """Invoke the help command or default help command if help extensions is not loaded.""" + if 'bot.exts.evergreen.help' in ctx.bot.extensions: + help_command = ctx.bot.get_command('help') + await ctx.invoke(help_command, ctx.command.qualified_name) + return + await ctx.send_help(ctx.command) + EXTENSIONS = frozenset(walk_extensions()) |