secondes -> minutes
This commit is contained in:
parent
28c74ba78e
commit
e8e82439c9
14
slowbot.py
14
slowbot.py
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue