Ajout de l'encodage d'image en base64 pour les commandes de personnage

This commit is contained in:
GZod01 2024-12-15 15:15:27 +01:00
parent acba8c9acb
commit df0ebbb4ad

View file

@ -2,6 +2,9 @@ from discord import app_commands
import discord
from GammaRPBot_Define import GammaRPBot
import aiosqlite
import base64
async def setup(bot:GammaRPBot):
bot.tree.add_command(PersoCommands(bot))
class PersoCommands(app_commands.Group):
@ -25,7 +28,10 @@ class PersoCommands(app_commands.Group):
pouvoirs = powers
uuid=interaction.user.id
guild_id = interaction.guild.id
image_blob=await image.read()
image_blob_raw=await image.read()
image_blob_b64 = base64.b64encode(image_blob_raw).decode("utf-8")
ext = image.filename.split(".")[-1]
image_blob=f"data:image/{ext};base64,{image_blob_b64}"
print(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,guild_id)
print(image.filename)
print(image.url)