V2.1: Plafond negatif, reserve vault, carte bancaire visuelle, panel rewrite
- db: added client_negative_floor column to banks - bank_manager: vault check on depot, negative floor on retrait/virement - banque: new /banque set-plafond and /banque set-reserve commands - bank_card: new Pillow-based bank card image generator - panel: full rewrite (no more JSON), guild name in title, new banking flow
This commit is contained in:
parent
c9ad155bf6
commit
48ec3a3d89
5 changed files with 868 additions and 1637 deletions
|
|
@ -240,6 +240,56 @@ class Banque(commands.Cog):
|
|||
except ValueError as e:
|
||||
await interaction.response.send_message(f"❌ {e}", ephemeral=True)
|
||||
|
||||
@banque_group.command(name="set-plafond", description="Définir le plafond négatif autorisé pour les comptes clients")
|
||||
@app_commands.describe(plafond="Plafond négatif (ex: 1000 = les clients peuvent descendre à -1000€)")
|
||||
async def set_plafond(self, interaction: discord.Interaction, plafond: float):
|
||||
bank = await self._get_user_bank(interaction)
|
||||
if not bank:
|
||||
await interaction.response.send_message(
|
||||
"❌ Vous n'avez pas de rôle de banquier sur ce serveur.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
if plafond < 0 or plafond > 10000:
|
||||
await interaction.response.send_message(
|
||||
"❌ Le plafond doit être entre 0 et 10000€.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
ok = await bank_manager.set_negative_floor(interaction.guild.id, bank["id"], plafond)
|
||||
if ok:
|
||||
await interaction.response.send_message(
|
||||
f"✅ Plafond négatif de **{bank['name']}** défini à **-{plafond:.2f}€**.",
|
||||
ephemeral=True,
|
||||
)
|
||||
else:
|
||||
await interaction.response.send_message("❌ Erreur.", ephemeral=True)
|
||||
|
||||
@banque_group.command(name="set-reserve", description="Définir le montant de la réserve bancaire (vault)")
|
||||
@app_commands.describe(montant="Montant de la réserve")
|
||||
async def set_reserve(self, interaction: discord.Interaction, montant: float):
|
||||
bank = await self._get_user_bank(interaction)
|
||||
if not bank:
|
||||
await interaction.response.send_message(
|
||||
"❌ Vous n'avez pas de rôle de banquier sur ce serveur.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
if montant < 0:
|
||||
await interaction.response.send_message(
|
||||
"❌ La réserve ne peut pas être négative.", ephemeral=True
|
||||
)
|
||||
return
|
||||
|
||||
ok = await bank_manager.set_vault_balance(interaction.guild.id, bank["id"], montant)
|
||||
if ok:
|
||||
await interaction.response.send_message(
|
||||
f"✅ Réserve de **{bank['name']}** définie à **{montant:.2f}€**.",
|
||||
ephemeral=True,
|
||||
)
|
||||
else:
|
||||
await interaction.response.send_message("❌ Erreur.", ephemeral=True)
|
||||
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(Banque(bot))
|
||||
|
|
|
|||
2223
commandes/panel.py
2223
commandes/panel.py
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue