From 4f02b4c3425c416592c49141dd2c756c221d8aa2 Mon Sep 17 00:00:00 2001 From: GZod01 Date: Sun, 15 Dec 2024 16:23:20 +0100 Subject: [PATCH] =?UTF-8?q?Suppression=20des=20messages=20de=20d=C3=A9boga?= =?UTF-8?q?ge=20dans=20la=20fonction=20say=5Fmessage=20pour=20un=20code=20?= =?UTF-8?q?plus=20propre?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main-bot.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/main-bot.py b/main-bot.py index a693bf6..6cea2c5 100644 --- a/main-bot.py +++ b/main-bot.py @@ -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) \ No newline at end of file