diff options
author | 2021-03-12 19:17:39 -0500 | |
---|---|---|
committer | 2021-03-12 19:17:39 -0500 | |
commit | cc72d484115a8acebf0fafe8bb332817168d3acd (patch) | |
tree | fd5ac32633bf9eac9ec0f1f8428014c48d9e5101 /bot/utils/extensions.py | |
parent | change ctx.send_help to ctx.invoke(help_command) (diff) |
make utility invoke_help_command function
Diffstat (limited to 'bot/utils/extensions.py')
-rw-r--r-- | bot/utils/extensions.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bot/utils/extensions.py b/bot/utils/extensions.py index 50350ea8..56f6dd00 100644 --- a/bot/utils/extensions.py +++ b/bot/utils/extensions.py @@ -4,6 +4,7 @@ import pkgutil from typing import Iterator, NoReturn from bot import exts +from discord.ext.commands import Context def unqualify(name: str) -> str: @@ -31,4 +32,15 @@ def walk_extensions() -> Iterator[str]: yield module.name +async def invoke_help_command(ctx: Context, *commands: str) -> None: + """Invoke the help command, and will use the default help command + if the help exten is not loaded. + """ + + if 'bot.exts.evergreen.help' in ctx.bot.extensions: + help_command = ctx.bot.get_command('help') + await ctx.invoke(help_command, *commands) + return + await ctx.send_help(''.join(commands)) + EXTENSIONS = frozenset(walk_extensions()) |