diff --git a/perso_commands.py b/perso_commands.py index 50707e5..ac885b4 100644 --- a/perso_commands.py +++ b/perso_commands.py @@ -31,11 +31,10 @@ class PersoCommands(app_commands.Group): @app_commands.describe(short_name="Le nom court du personnage (son ID)", full_name="Le nom complet du personnage", story="L'histoire du personnage",powers="Les pouvoirs du personnage",age="L'âge du personnage", sexe="Le sexe du personnage", - # guild_only="Personnage global ou uniquement sur ce serveur", + global_character="Le personnage est il global ou reservé à ce serveur", image="L'image du personnage") - # @app_commands.choices(guild_only=[app_commands.Choice(name="Global",value="global"),app_commands.Choice(name="Ce serveur uniquement", value="guild")]) async def create_character(self,interaction:discord.Interaction,short_name:str,full_name:str,image:discord.Attachment,story:str,powers:str,age:int,sexe:str, - # guild_only:app_commands.Choice[str] + global_character:bool=False ): nom_court = short_name nom_complet= full_name @@ -60,7 +59,11 @@ class PersoCommands(app_commands.Group): print(image.filename) print(image.url) try: - res = await self.bot.db.execute("INSERT INTO personnages (nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,image) VALUES (?,?,?,?,?,?,?,?)",(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,perso_image_url)) + res + if global_character: + res = await self.bot.db.execute("INSERT INTO personnages (nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,image) VALUES (?,?,?,?,?,?,?,?)",(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,perso_image_url)) + else: + res=await self.bot.db.execute("INSERT INTO personnages (nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,image,guild_id) VALUES (?,?,?,?,?,?,?,?)",(nom_court,nom_complet,histoire,pouvoirs,age,sexe,uuid,perso_image_url,guild_id)) print(res) await res.close() await self.bot.db.commit()