diff --git a/main.py b/main.py index 81c9a1a..e3e666f 100755 --- a/main.py +++ b/main.py @@ -474,6 +474,33 @@ async def addemoji(args: list[str], message: discord.Message) -> tuple[str, bool return f"added {emoji} with id {emoji.id}", False +@register("addcolor", 1) +async def addcolor(args: list[str], message: discord.Message) -> tuple[str, bool]: + if message.guild.id != 1480697029780045875: + return "this command cannot be ran in this server", True + + if not message.author.guild_permissions.manage_guild: + return "no permission", True + + if len(args) != 1: + return "i dont understand this command", True + + from PIL import Image, ImageDraw + from io import BytesIO + image = Image.new("RGBA", (128, 128), (0, 0, 0, 0)) + draw = ImageDraw.Draw(image) + draw.rounded_rectangle([0, 0, 128, 128], radius=32, fill=args[0]) + buffer = BytesIO() + image.save(buffer, format="PNG") + image_bytes = buffer.getvalue() + + emoji = await EMOJI_STORAGE.try_add_emoji(args[0].removeprefix('#'), image_bytes) + if emoji is None: + return "failed to add emoji", True + + return f"added {emoji} with id {emoji.id}", False + + @register("editdesc", 3) async def editdesc(args: list[str], message: discord.Message) -> tuple[str, bool]: if not message.author.guild_permissions.manage_guild: @@ -650,9 +677,10 @@ Usage: - {CONFIG.prefix}send channel-id header (optional): Sends a message with `header` as it's top contents to be used for reaction roles - {CONFIG.prefix}track channel-id message-id: Track an existing message for reaction roles - {CONFIG.prefix}add message-id emoji/emoji-id role-id/role-name description: Adds a reaction role to message with `message-id` displayed as `emoji` `description` that gives you `role` -- {CONFIG.prefix}remove message-id;emoji: Removes a reaction role from a tracked message +- {CONFIG.prefix}remove message-id emoji: Removes a reaction role from a tracked message - {CONFIG.prefix}delete message-id: Deletes a tracked message that the bot owns - {CONFIG.prefix}addemoji emoji-name + attachment: Adds emoji to the emoji storage. Only available for the "fuck alpinedevs,systemd,... server" +- {CONFIG.prefix}addcolor #RRGGBB: Same as addemoji but for color emojis - {CONFIG.prefix}editdesc message-id emoji header: Edit description for a reaction roles emoji - {CONFIG.prefix}edithdr message-id header: Edit header for a reaction roles message""", color=discord.Color(0xa2d2df)