aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/utilities/colour.py
diff options
context:
space:
mode:
authorGravatar bradtimmis <[email protected]>2021-11-09 20:44:28 -0500
committerGravatar bradtimmis <[email protected]>2021-11-09 20:44:28 -0500
commit93e6e96c89e621db6e463f4d5716533fd85cd96f (patch)
treeb605207bf354cab7ed7770776ff057628ba3901b /bot/exts/utilities/colour.py
parentchore: pull hex match out of try/except block (diff)
chore: re-arrange command invocation with try/except
Diffstat (limited to 'bot/exts/utilities/colour.py')
-rw-r--r--bot/exts/utilities/colour.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/bot/exts/utilities/colour.py b/bot/exts/utilities/colour.py
index 656dddba..e69930f4 100644
--- a/bot/exts/utilities/colour.py
+++ b/bot/exts/utilities/colour.py
@@ -75,12 +75,14 @@ class Colour(commands.Cog):
@commands.group(aliases=("color",), invoke_without_command=True)
async def colour(self, ctx: commands.Context, *, extra: str) -> None:
"""User initiated command to create an embed that displays colour information."""
- if ctx.invoked_subcommand is None:
- try:
- extra_colour = ImageColor.getrgb(extra)
- await self.send_colour_response(ctx, extra_colour)
- except ValueError:
- await invoke_help_command(ctx)
+ if ctx.invoked_subcommand:
+ return
+
+ try:
+ extra_colour = ImageColor.getrgb(extra)
+ await self.send_colour_response(ctx, extra_colour)
+ except ValueError:
+ await invoke_help_command(ctx)
@colour.command()
async def rgb(self, ctx: commands.Context, red: int, green: int, blue: int) -> None: