Modification de la fonction perso_embed pour utiliser io.BytesIO lors de l'envoi de l'image, améliorant ainsi la gestion des fichiers.
This commit is contained in:
parent
d2ebe5ae34
commit
7e57ff0000
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ import discord
|
||||||
from GammaRPBot_Define import GammaRPBot
|
from GammaRPBot_Define import GammaRPBot
|
||||||
import aiosqlite
|
import aiosqlite
|
||||||
import base64
|
import base64
|
||||||
|
import io
|
||||||
|
|
||||||
|
|
||||||
_sql_table="""CREATE TABLE personnages (
|
_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 = perso_datas["image"] #data:image/png;base64,xxxxxx
|
||||||
perso_image_b64=perso_image.split(",")[1]
|
perso_image_b64=perso_image.split(",")[1]
|
||||||
perso_image_raw = base64.b64decode(perso_image_b64)
|
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)
|
a = await bot.get_guild(1037663859621765160).get_channel(1317876780635394068).send(file=perso_image_file)
|
||||||
print(a.attachments)
|
print(a.attachments)
|
||||||
perso_image_url = a.attachments[0].url
|
perso_image_url = a.attachments[0].url
|
||||||
|
|
Loading…
Reference in a new issue