secondes -> minutes

This commit is contained in:
nemo 2025-06-16 14:04:27 +02:00
parent 28c74ba78e
commit e8e82439c9
1 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ intents.message_content = True
intents.guilds = True
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
bot = commands.Bot(intents=intents)
# Configuration par défaut
config = {
@ -48,11 +48,11 @@ async def on_ready():
print(f"Erreur lors de la sync des commandes : {e}")
# Slash command : définir le slowmode
@bot.tree.command(name="setslowmode", description="Définit la durée du slowmode dans les threads (en secondes)")
@bot.tree.command(name="setslowmode", description="Définit la durée du slowmode dans les threads (en minutes)")
@app_commands.checks.has_permissions(manage_threads=True)
@app_commands.describe(seconds="Durée du slowmode en secondes")
async def setslowmode(interaction: discord.Interaction, seconds: int):
config["slowmode_duration"] = seconds
@app_commands.describe(minutes="Durée du slowmode en minutes")
async def setslowmode(interaction: discord.Interaction, minutes: int):
config["slowmode_duration"] = minutes
save_config()
updated_threads = 0
@ -61,12 +61,12 @@ async def setslowmode(interaction: discord.Interaction, seconds: int):
for thread in interaction.guild.threads:
if not thread.archived:
try:
await thread.edit(slowmode_delay=seconds)
await thread.edit(slowmode_delay=minutes*60)
updated_threads += 1
except Exception as e:
failed_threads.append(thread.name)
message = f"✅ Slowmode par défaut défini à {seconds} secondes.\n"
message = f"✅ Slowmode par défaut défini à {seconds} minutes.\n"
message += f"🧵 Slowmode mis à jour dans {updated_threads} thread(s)."
if failed_threads:
@ -166,4 +166,4 @@ async def on_app_command_error(interaction: discord.Interaction, error):
print(f"Erreur commande slash : {error}")
# Lancer le bot (⚠️ remplace la clé par une vraie token sécurisée)
bot.run("MTM4MTk4ODA2NjUwMzQzMDI0Nw.G_7FMX.DMZ32kmoTHRnGHaQ1TEc_o1EwHAt-Tvkkb-ADQ")
bot.run("MTM4MTk4ODA2NjUwMzQzMDI0Nw.G_7FMX.DMZ32kmoTHRnGHaQ1TEc_o1EwHAt-Tvkkb-ADQ")