Suppression des messages de débogage dans la fonction say_message pour un code plus propre

This commit is contained in:
GZod01 2024-12-15 16:23:20 +01:00
parent b45d99ff84
commit 4f02b4c342

View file

@ -51,33 +51,34 @@ async def say(interaction:discord.Interaction,id:str,message:str):
async def say_message(userid:int, guildid:int, shortname:str, message:str,channel:discord.TextChannel):
print("HELLOWORODL")
print(userid,guildid,shortname,message,channel)
# print("HELLOWORODL")
# print(userid,guildid,shortname,message,channel)
res = await bot.db.execute("SELECT * FROM personnages WHERE uuid=? AND (guild_id=? OR guild_id IS NULL) AND nom_court=?",(userid,guildid,shortname))
row = await res.fetchone()
await res.close()
if row is None:
return False
print("ok")
# print("ok")
short_name = row["nom_court"]
full_name = row["nom_complet"]
perso_image = row["image"] #data:image/png;base64,xxxxxx
perso_image_b64=perso_image.split(",")[1]
perso_image_raw = base64.b64decode(perso_image_b64)
print(short_name,full_name,perso_image)
print(perso_image_raw)
# print(short_name,full_name,perso_image)
webhook = None
print("ok2")
# print("ok2")
if discord.utils.get(await channel.webhooks(),name=short_name) is None:
print("ok3");
# print("ok3");
webhook = await channel.create_webhook(name=short_name,avatar=perso_image_raw)
print("ok4")
# print("ok4")
else:
print("ok5")
# print("ok5")
webhook = discord.utils.get(await channel.webhooks(),name=short_name)
print("ok6")
print("ok7")
# print("ok6")
# print("ok7")
await webhook.send(message,username=full_name)
print("ok8")
# print("ok8")
return True
bot.run(bot_token)