diff --git a/perso_commands.py b/perso_commands.py index e00c969..530c2af 100644 --- a/perso_commands.py +++ b/perso_commands.py @@ -5,6 +5,18 @@ import aiosqlite import base64 +_sql_table="""CREATE TABLE personnages ( + nom_court varchar(255), + nom_complet text, + image blob, + histoire text, + pouvoirs text, + uuid TEXT, + age INTEGER, + sexe TEXT, + guild_id INTEGER NULL +)""" + async def setup(bot:GammaRPBot): bot.tree.add_command(PersoCommands(bot)) class PersoCommands(app_commands.Group): @@ -57,12 +69,11 @@ class PersoCommands(app_commands.Group): 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() + rows = await res.fetchall() await res.close() - print(dict_rows) message="" - for row in dict_rows: + for row in 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") + message+=f"Nom court: {row[0]}\nNom complet: {row[1]}\nHistoire: {row[3]}\nPouvoirs: {row[4]}\nAge: {row[6]}\nSexe: {row[7]}\n\n" await interaction.response.send_message("Liste des personnages\n"+message,ephemeral=True) \ No newline at end of file