diff --git a/jarvis.png b/jarvis.png index d2414a8..9484aba 100644 Binary files a/jarvis.png and b/jarvis.png differ diff --git a/jarvis.svg b/jarvis.svg new file mode 100644 index 0000000..43fe1e1 --- /dev/null +++ b/jarvis.svg @@ -0,0 +1,20 @@ + + + + + logotests + + + + + + + diff --git a/jarvis/__init__.py b/jarvis/__init__.py index 15b64f1..6cd17b2 100644 --- a/jarvis/__init__.py +++ b/jarvis/__init__.py @@ -41,7 +41,7 @@ jarvis = commands.Bot( slash = SlashCommand(jarvis, sync_commands=False, sync_on_cog_reload=True) jarvis_self = Process() -__version__ = "1.11.2" +__version__ = "1.11.3" @jarvis.event diff --git a/jarvis/cogs/util.py b/jarvis/cogs/util.py index 900c8b9..51a606a 100644 --- a/jarvis/cogs/util.py +++ b/jarvis/cogs/util.py @@ -6,11 +6,12 @@ from io import BytesIO import discord import discord_slash +import numpy as np from discord import File, Guild, Role, User from discord.ext import commands from discord_slash import SlashContext, cog_ext from discord_slash.utils.manage_commands import create_choice, create_option -from PIL import Image, ImageDraw +from PIL import Image import jarvis from jarvis import jarvis_self, logo @@ -20,6 +21,8 @@ from jarvis.data.robotcamo import emotes, hk, names from jarvis.utils import build_embed, convert_bytesize, get_repo_hash from jarvis.utils.field import Field +JARVIS_LOGO = Image.open("../../jarvis.png").convert("RGBA") + class UtilCog(commands.Cog): """ @@ -138,7 +141,6 @@ class UtilCog(commands.Cog): ], ) async def _roleinfo(self, ctx: SlashContext, role: Role) -> None: - fields = [ Field(name="ID", value=role.id), Field(name="Name", value=role.name), @@ -157,24 +159,25 @@ class UtilCog(commands.Cog): timestamp=role.created_at, ) embed.set_footer(text="Role Created") - embed.set_thumbnail(url="attachment://color_circle.png") + embed.set_thumbnail(url="attachment://color_show.png") - im = Image.new("RGBA", size=(200, 200), color=(0, 0, 0, 0)) - canvas = ImageDraw.Draw(im) + data = np.array(JARVIS_LOGO) + r, g, b, a = data.T - color = role.color.to_rgb() - color = list(color) - color.append(255) - color = tuple(color) - canvas.rectangle([(0, 0), (200, 200)], fill=color) - del canvas + yellow = (r == 255) & (g == 187) & (b == 0) + cyan = (r == 0) & (g == 140) & (b == 255) + + data[..., :-1][yellow.T] = list(role.color.to_rgb()) + data[..., :-1][cyan.T] = list(role.color.to_rgb()) + + im = Image.fromarray(data) with BytesIO() as image_bytes: im.save(image_bytes, "PNG") image_bytes.seek(0) - color_circle = File(image_bytes, filename="color_circle.png") + color_show = File(image_bytes, filename="color_show.png") - await ctx.send(embed=embed, file=color_circle) + await ctx.send(embed=embed, file=color_show) @cog_ext.cog_slash( name="userinfo",