a
This commit is contained in:
parent
22b5fe4fc2
commit
acba8c9acb
1 changed files with 12 additions and 0 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue