diff --git a/perso_commands.py b/perso_commands.py index 517634d..8dfdf34 100644 --- a/perso_commands.py +++ b/perso_commands.py @@ -35,4 +35,16 @@ class PersoCommands(app_commands.Group): 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) \ No newline at end of file + 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): + res = await self.bot.db.execute("SELECT * FROM personnages") + dict_rows = await res.fetchall() + await res.close() + print(dict_rows) + message="" + for row in dict_rows: + print(row) + message+=(f"Nom court: {row[0]}\nNom complet: {row[1]}\nHistoire: {row[2]}\nPouvoirs: {row[3]}\nAge: {row[4]}\nSexe: {row[5]}\nUUID: {row[6]}\nGuild ID: {row[7]}"+"\n\n") + await interaction.response.send_message("Liste des personnages\n"+message,ephemeral=True) + \ No newline at end of file