diff --git a/perso_commands.py b/perso_commands.py index 8dfdf34..b2b6367 100644 --- a/perso_commands.py +++ b/perso_commands.py @@ -1,6 +1,7 @@ from discord import app_commands import discord from GammaRPBot_Define import GammaRPBot +import aiosqlite async def setup(bot:GammaRPBot): bot.tree.add_command(PersoCommands(bot)) class PersoCommands(app_commands.Group): @@ -27,6 +28,8 @@ class PersoCommands(app_commands.Group): image_blob=await image.read() print(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,guild_id) print(image.filename) + print(image.url) + print(image_blob) try: res = await self.bot.db.execute("INSERT INTO personnages (nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,guild_id,image) VALUES (?,?,?,?,?,?,?,?,?)",(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,guild_id,image_blob)) print(res) @@ -35,9 +38,18 @@ class PersoCommands(app_commands.Group): print(e) await interaction.response.send_message("Erreur lors de la création du personnage",ephemeral=True) return + except aiosqlite.Warning as w: + print(w) + await interaction.response.send_message("Erreur lors de la création du personnage",ephemeral=True) + return + except aiosqlite.Error as e: + print(e) + await interaction.response.send_message("Erreur lors de la création du personnage",ephemeral=True) + return await interaction.response.send_message("Personnage créé",ephemeral=True) @app_commands.command(name="lister",description="Liste tous les personnages") async def list_characters(self,interaction:discord.Interaction): + print("perso list") res = await self.bot.db.execute("SELECT * FROM personnages") dict_rows = await res.fetchall() await res.close()