diff options
author | 2021-09-07 07:39:21 -0400 | |
---|---|---|
committer | 2021-10-05 16:41:43 +0100 | |
commit | 1ee1fb10570b55561fc9b8bf42c01a5cc7e8171a (patch) | |
tree | b52813c2472bcc8ef1b806efd0e7fd6a3cff9056 /bot/exts | |
parent | Continue work in progress (diff) |
Fixing flake8 errors, code style
Still a work in progress but commenting out stub code and unused
imports. List of To-Do's still applies.
Diffstat (limited to 'bot/exts')
-rw-r--r-- | bot/exts/utilities/color.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/bot/exts/utilities/color.py b/bot/exts/utilities/color.py index 1a4f7031..b1a77b28 100644 --- a/bot/exts/utilities/color.py +++ b/bot/exts/utilities/color.py @@ -1,5 +1,5 @@ # imports -import colorsys +# import colorsys import logging import re from io import BytesIO @@ -7,10 +7,10 @@ from io import BytesIO from PIL import Image, ImageColor from discord import Embed, File from discord.ext import commands -from rapidfuzz import process +# from rapidfuzz import process from bot.bot import Bot -from bot.constants import Colours +# from bot.constants import Colours logger = logging.getLogger(__name__) @@ -46,12 +46,14 @@ class Color(commands.Cog): hex_color = int(hex(int(user_color.replace("#", ""), 16)), 0) logger.info(f"{hex_color = }") rgb_color = ImageColor.getcolor(user_color, "RGB") + logger.info(f"{rgb_color = }") else: - await ctx.send(embed=Embed( + await ctx.send( + embed=Embed( title="An error has occured.", - description=ERROR_MSG.format(user_color=user_color) - ) + description=ERROR_MSG.format(user_color=user_color), ) + ) elif "RGB" or "rgb" in user_color: rgb_parse = user_color.split() @@ -64,7 +66,7 @@ class Color(commands.Cog): hex_color = f"0x{int(rgb[0]):02x}{int(rgb[1]):02x}{int(rgb[2]):02x}" main_embed = Embed( - title=user_color, + title=user_color, # need to replace with fuzzymatch color name color=hex_color, ) async with ctx.typing(): @@ -75,7 +77,6 @@ class Color(commands.Cog): async def _create_thumbnail_attachment(self, color: str) -> File: """Generate a thumbnail from `color`.""" - thumbnail = Image.new("RGB", (100, 100), color=color) bufferedio = BytesIO() thumbnail.save(bufferedio, format="PNG") @@ -85,11 +86,8 @@ class Color(commands.Cog): return file - # if user_color in color_lists: - # # TODO fuzzy match for color - # pass - + # # fuzzy match for color def setup(bot: Bot) -> None: |