From 7e57ff000044a15381c0f9406ee4ba0062cb76b0 Mon Sep 17 00:00:00 2001 From: GZod01 Date: Sun, 15 Dec 2024 16:41:28 +0100 Subject: [PATCH] =?UTF-8?q?Modification=20de=20la=20fonction=20perso=5Femb?= =?UTF-8?q?ed=20pour=20utiliser=20io.BytesIO=20lors=20de=20l'envoi=20de=20?= =?UTF-8?q?l'image,=20am=C3=A9liorant=20ainsi=20la=20gestion=20des=20fichi?= =?UTF-8?q?ers.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- perso_commands.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perso_commands.py b/perso_commands.py index 861859e..6077c31 100644 --- a/perso_commands.py +++ b/perso_commands.py @@ -3,6 +3,7 @@ import discord from GammaRPBot_Define import GammaRPBot import aiosqlite import base64 +import io _sql_table="""CREATE TABLE personnages ( @@ -82,7 +83,7 @@ async def perso_embed(bot:GammaRPBot,perso_datas)->discord.embeds.Embed: perso_image = perso_datas["image"] #data:image/png;base64,xxxxxx perso_image_b64=perso_image.split(",")[1] perso_image_raw = base64.b64decode(perso_image_b64) - perso_image_file = discord.File(perso_image_raw) + perso_image_file = discord.File(io.BytesIO(perso_image_raw)) a = await bot.get_guild(1037663859621765160).get_channel(1317876780635394068).send(file=perso_image_file) print(a.attachments) perso_image_url = a.attachments[0].url