aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-03-13 10:16:31 -0500
committerGravatar ToxicKidz <[email protected]>2021-03-13 10:16:31 -0500
commit9ec1cf9b983a69c381507f82c317e0465eecdc35 (patch)
tree7deaf95949693aafc7592dfe7933425ebdc8f6dc
parentMake flake8 happy again. (diff)
make invoke_help_command only take ctx
-rw-r--r--bot/exts/christmas/advent_of_code/_cog.py2
-rw-r--r--bot/exts/evergreen/emoji.py2
-rw-r--r--bot/exts/evergreen/game.py2
-rw-r--r--bot/exts/evergreen/minesweeper.py2
-rw-r--r--bot/exts/evergreen/movie.py2
-rw-r--r--bot/exts/evergreen/snakes/_snakes_cog.py2
-rw-r--r--bot/exts/evergreen/space.py2
-rw-r--r--bot/exts/evergreen/status_codes.py2
-rw-r--r--bot/exts/utils/extensions.py8
-rw-r--r--bot/exts/valentines/be_my_valentine.py2
-rw-r--r--bot/utils/extensions.py6
11 files changed, 16 insertions, 16 deletions
diff --git a/bot/exts/christmas/advent_of_code/_cog.py b/bot/exts/christmas/advent_of_code/_cog.py
index 6ba5c2af..dc3d7616 100644
--- a/bot/exts/christmas/advent_of_code/_cog.py
+++ b/bot/exts/christmas/advent_of_code/_cog.py
@@ -52,7 +52,7 @@ class AdventOfCode(commands.Cog):
async def adventofcode_group(self, ctx: commands.Context) -> None:
"""All of the Advent of Code commands."""
if not ctx.invoked_subcommand:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@adventofcode_group.command(
name="subscribe",
diff --git a/bot/exts/evergreen/emoji.py b/bot/exts/evergreen/emoji.py
index e55a11ad..fa3044e3 100644
--- a/bot/exts/evergreen/emoji.py
+++ b/bot/exts/evergreen/emoji.py
@@ -76,7 +76,7 @@ class Emojis(commands.Cog):
if emoji is not None:
await ctx.invoke(self.info_command, emoji)
else:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@emoji_group.command(name="count", aliases=("c",))
async def count_command(self, ctx: commands.Context, *, category_query: str = None) -> None:
diff --git a/bot/exts/evergreen/game.py b/bot/exts/evergreen/game.py
index a6bfecaa..068d3f68 100644
--- a/bot/exts/evergreen/game.py
+++ b/bot/exts/evergreen/game.py
@@ -235,7 +235,7 @@ class Games(Cog):
"""
# When user didn't specified genre, send help message
if genre is None:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
return
# Capitalize genre for check
diff --git a/bot/exts/evergreen/minesweeper.py b/bot/exts/evergreen/minesweeper.py
index cfe7150e..3031debc 100644
--- a/bot/exts/evergreen/minesweeper.py
+++ b/bot/exts/evergreen/minesweeper.py
@@ -84,7 +84,7 @@ class Minesweeper(commands.Cog):
@commands.group(name='minesweeper', aliases=('ms',), invoke_without_command=True)
async def minesweeper_group(self, ctx: commands.Context) -> None:
"""Commands for Playing Minesweeper."""
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@staticmethod
def get_neighbours(x: int, y: int) -> typing.Generator[typing.Tuple[int, int], None, None]:
diff --git a/bot/exts/evergreen/movie.py b/bot/exts/evergreen/movie.py
index 63ce81da..b3bfe998 100644
--- a/bot/exts/evergreen/movie.py
+++ b/bot/exts/evergreen/movie.py
@@ -74,7 +74,7 @@ class Movie(Cog):
try:
result = await self.get_movies_list(self.http_session, MovieGenres[genre].value, 1)
except KeyError:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
return
# Check if "results" is in result. If not, throw error.
diff --git a/bot/exts/evergreen/snakes/_snakes_cog.py b/bot/exts/evergreen/snakes/_snakes_cog.py
index d0e60819..3732b559 100644
--- a/bot/exts/evergreen/snakes/_snakes_cog.py
+++ b/bot/exts/evergreen/snakes/_snakes_cog.py
@@ -441,7 +441,7 @@ class Snakes(Cog):
@group(name='snakes', aliases=('snake',), invoke_without_command=True)
async def snakes_group(self, ctx: Context) -> None:
"""Commands from our first code jam."""
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@bot_has_permissions(manage_messages=True)
@snakes_group.command(name='antidote')
diff --git a/bot/exts/evergreen/space.py b/bot/exts/evergreen/space.py
index 305d6721..323ff659 100644
--- a/bot/exts/evergreen/space.py
+++ b/bot/exts/evergreen/space.py
@@ -64,7 +64,7 @@ class Space(Cog):
@group(name="space", invoke_without_command=True)
async def space(self, ctx: Context) -> None:
"""Head command that contains commands about space."""
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@space.command(name="apod")
async def apod(self, ctx: Context, date: Optional[str] = None) -> None:
diff --git a/bot/exts/evergreen/status_codes.py b/bot/exts/evergreen/status_codes.py
index 127f3424..7c00fe20 100644
--- a/bot/exts/evergreen/status_codes.py
+++ b/bot/exts/evergreen/status_codes.py
@@ -19,7 +19,7 @@ class HTTPStatusCodes(commands.Cog):
async def http_status_group(self, ctx: commands.Context) -> None:
"""Group containing dog and cat http status code commands."""
if not ctx.invoked_subcommand:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@http_status_group.command(name='cat')
async def http_cat(self, ctx: commands.Context, code: int) -> None:
diff --git a/bot/exts/utils/extensions.py b/bot/exts/utils/extensions.py
index 4bd606b0..64e404d2 100644
--- a/bot/exts/utils/extensions.py
+++ b/bot/exts/utils/extensions.py
@@ -77,7 +77,7 @@ class Extensions(commands.Cog):
@group(name="extensions", aliases=("ext", "exts", "c", "cogs"), invoke_without_command=True)
async def extensions_group(self, ctx: Context) -> None:
"""Load, unload, reload, and list loaded extensions."""
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@extensions_group.command(name="load", aliases=("l",))
async def load_command(self, ctx: Context, *extensions: Extension) -> None:
@@ -87,7 +87,7 @@ class Extensions(commands.Cog):
If '\*' or '\*\*' is given as the name, all unloaded extensions will be loaded.
""" # noqa: W605
if not extensions:
- await invoke_help_command(ctx, "extensions", ctx.command.name)
+ await invoke_help_command(ctx)
return
if "*" in extensions or "**" in extensions:
@@ -104,7 +104,7 @@ class Extensions(commands.Cog):
If '\*' or '\*\*' is given as the name, all loaded extensions will be unloaded.
""" # noqa: W605
if not extensions:
- await invoke_help_command(ctx, "extensions", ctx.command.name)
+ await invoke_help_command(ctx)
return
blacklisted = "\n".join(UNLOAD_BLACKLIST & set(extensions))
@@ -130,7 +130,7 @@ class Extensions(commands.Cog):
If '\*\*' is given as the name, all extensions, including unloaded ones, will be reloaded.
""" # noqa: W605
if not extensions:
- await invoke_help_command(ctx, "extensions", ctx.command.name)
+ await invoke_help_command(ctx)
return
if "**" in extensions:
diff --git a/bot/exts/valentines/be_my_valentine.py b/bot/exts/valentines/be_my_valentine.py
index d5cc8644..09591cf8 100644
--- a/bot/exts/valentines/be_my_valentine.py
+++ b/bot/exts/valentines/be_my_valentine.py
@@ -44,7 +44,7 @@ class BeMyValentine(commands.Cog):
2) use the command \".lovefest unsub\" to get rid of the lovefest role.
"""
if not ctx.invoked_subcommand:
- await invoke_help_command(ctx, ctx.command.name)
+ await invoke_help_command(ctx)
@lovefest_role.command(name="sub")
async def add_role(self, ctx: commands.Context) -> None:
diff --git a/bot/utils/extensions.py b/bot/utils/extensions.py
index ffa8a936..459588a1 100644
--- a/bot/utils/extensions.py
+++ b/bot/utils/extensions.py
@@ -33,12 +33,12 @@ def walk_extensions() -> Iterator[str]:
yield module.name
-async def invoke_help_command(ctx: Context, *commands: str) -> None:
+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, *commands)
+ await ctx.invoke(help_command, ctx.command.qualified_name)
return
- await ctx.send_help(''.join(commands))
+ await ctx.send_help(ctx.command)
EXTENSIONS = frozenset(walk_extensions())