aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar brad90four <[email protected]>2021-10-28 09:13:49 -0400
committerGravatar brad90four <[email protected]>2021-10-28 09:13:49 -0400
commit364a7083ab38c3055c6db514e5203d68d61eb597 (patch)
treea9e51ee6ebcc34962cb3b9fc44bc75ee846e15ac
parentchore: correct capitalization of command name in embed (diff)
chore: change COLOUR_MAPPING to colour_mapping
-rw-r--r--bot/exts/utilities/color.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/exts/utilities/color.py b/bot/exts/utilities/color.py
index 573039fa..9356577f 100644
--- a/bot/exts/utilities/color.py
+++ b/bot/exts/utilities/color.py
@@ -21,7 +21,7 @@ class Colour(commands.Cog):
def __init__(self, bot: Bot):
self.bot = bot
with open(pathlib.Path("bot/resources/utilities/ryanzec_colours.json")) as f:
- self.COLOUR_MAPPING = json.load(f)
+ self.colour_mapping = json.load(f)
async def send_colour_response(self, ctx: commands.Context, rgb: tuple[int, int, int]) -> None:
"""Create and send embed from user given colour information."""
@@ -105,7 +105,7 @@ class Colour(commands.Cog):
@colour.command()
async def random(self, ctx: commands.Context) -> None:
"""Command to create an embed from a randomly chosen colour from the reference file."""
- hex_colour = random.choice(list(self.COLOUR_MAPPING.values()))
+ hex_colour = random.choice(list(self.colour_mapping.values()))
hex_tuple = ImageColor.getrgb(f"#{hex_colour}")
await self.send_colour_response(ctx, hex_tuple)
@@ -161,10 +161,10 @@ class Colour(commands.Cog):
try:
match, certainty, _ = process.extractOne(
query=input_hex_colour,
- choices=self.COLOUR_MAPPING.values(),
+ choices=self.colour_mapping.values(),
score_cutoff=80
)
- colour_name = [name for name, hex_code in self.COLOUR_MAPPING.items() if hex_code == match][0]
+ colour_name = [name for name, hex_code in self.colour_mapping.items() if hex_code == match][0]
except TypeError:
colour_name = None
return colour_name
@@ -174,10 +174,10 @@ class Colour(commands.Cog):
try:
match, certainty, _ = process.extractOne(
query=input_colour_name,
- choices=self.COLOUR_MAPPING.keys(),
+ choices=self.colour_mapping.keys(),
score_cutoff=90
)
- hex_match = f"#{self.COLOUR_MAPPING[match]}"
+ hex_match = f"#{self.colour_mapping[match]}"
except (ValueError, TypeError):
hex_match = None
return hex_match