aboutsummaryrefslogtreecommitdiffstats
path: root/bot/utils/extensions.py
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2021-04-02 14:53:45 +0100
committerGravatar Chris <[email protected]>2021-04-02 14:53:45 +0100
commitaa4d16acca8b9ccf8ce395c70dad416506021c59 (patch)
tree54a2d083de3a0527c300a09e548ee0a97305f6bc /bot/utils/extensions.py
parentDon't allow users to run the issue command in DMs, given error feedback. (diff)
parentMerge branch 'main' into Handle-DMChannels (diff)
Merge branch 'Handle-DMChannels' of github.com:ChrisLovering/sir-lancebot into Handle-DMChannels
Diffstat (limited to 'bot/utils/extensions.py')
-rw-r--r--bot/utils/extensions.py10
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())