Initial commit: bot Discord Vicy V1.8
This commit is contained in:
commit
56958c5832
70 changed files with 8469 additions and 0 deletions
30
commandes/roll.py
Normal file
30
commandes/roll.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import random
|
||||
from discord import app_commands
|
||||
|
||||
# Supposons que tu as accès à l'objet bot ou client principal
|
||||
# Utilise bot.tree ou client.tree directement
|
||||
|
||||
@app_commands.command(
|
||||
name="roll",
|
||||
description="Lancer un dé entre deux valeurs avec une raison."
|
||||
)
|
||||
@app_commands.describe(
|
||||
minimum="Valeur minimale",
|
||||
maximum="Valeur maximale",
|
||||
action="Raison du lancer de dé"
|
||||
)
|
||||
async def roll(interaction, minimum: int, maximum: int, action: str):
|
||||
if minimum > maximum:
|
||||
await interaction.response.send_message(
|
||||
"❌ La valeur minimale doit être inférieure ou égale à la valeur maximale.", ephemeral=True
|
||||
)
|
||||
return
|
||||
result = random.randint(minimum, maximum)
|
||||
await interaction.response.send_message(
|
||||
f"🎲 **{interaction.user.display_name}** a lancé un dé pour l'action *{action}*\n"
|
||||
f"Résultat : **{result}** (entre {minimum} et {maximum})"
|
||||
)
|
||||
|
||||
# Pour enregistrer la commande dans le bot :
|
||||
async def setup(bot):
|
||||
bot.tree.add_command(roll)
|
||||
Loading…
Add table
Add a link
Reference in a new issue