diff options
author | 2021-10-29 07:03:59 -0400 | |
---|---|---|
committer | 2021-10-29 07:03:59 -0400 | |
commit | 930c9649eaec79cebfa2969501b4614ccd26d069 (patch) | |
tree | fa6a3940cf648b2dfc4ffd5df802556078caaf3d /bot | |
parent | fix: correct ranges and logic for color error handling (diff) |
chore: add some conditions for the embed variables
Diffstat (limited to 'bot')
-rw-r--r-- | bot/exts/utilities/color.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/bot/exts/utilities/color.py b/bot/exts/utilities/color.py index 587d4e18..a21b74e4 100644 --- a/bot/exts/utilities/color.py +++ b/bot/exts/utilities/color.py @@ -28,16 +28,25 @@ class Colour(commands.Cog): """Create and send embed from user given colour information.""" r, g, b = rgb name = self._rgb_to_name(rgb) - colour_mode = ctx.invoked_with + if name == "No match found": + name = None + try: colour_or_color = ctx.invoked_parents[0] except IndexError: colour_or_color = "colour" - input_colour = ctx.args[2:][0] + + colour_mode = ctx.invoked_with + if colour_mode == "random": + input_colour = "random" + else: + input_colour = ctx.args[2:][0] + if colour_mode not in ("name", "hex", "random"): colour_mode = colour_mode.upper() else: colour_mode = colour_mode.title() + desc = f"{colour_mode} information for `{name or input_colour}`." colour_embed = Embed( title=colour_or_color.title(), |