From 93e6e96c89e621db6e463f4d5716533fd85cd96f Mon Sep 17 00:00:00 2001 From: bradtimmis Date: Tue, 9 Nov 2021 20:44:28 -0500 Subject: chore: re-arrange command invocation with try/except --- bot/exts/utilities/colour.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'bot/exts/utilities/colour.py') 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: -- cgit v1.2.3