Initialisation du repository de Beta

This commit is contained in:
Mathis 2026-02-06 22:23:20 +01:00
commit 14985f6dbb
9469 changed files with 1903273 additions and 0 deletions

View file

@ -0,0 +1,42 @@
import discord
async def execute(bot, params, message):
users = params.get('users', [])
if not users:
# Fallback for single user
users = [params]
timed_out_count = 0
for user_params in users:
target_mention = user_params.get('target_user_mention')
duration = user_params.get('duration', 10) # default 10 minutes
# Parse mention or ID
if target_mention.startswith('<@') and target_mention.endswith('>'):
user_id = int(target_mention[2:-1])
elif target_mention.startswith('<@!') and target_mention.endswith('>'):
user_id = int(target_mention[3:-1])
elif target_mention.startswith('@'):
# Handle @username
username = target_mention[1:] # Remove @
member = discord.utils.find(lambda m: m.name == username or m.display_name == username, message.guild.members)
if not member:
await message.channel.send(f"Utilisateur {target_mention} introuvable.")
continue
user_id = member.id
else:
try:
user_id = int(target_mention)
except ValueError:
await message.channel.send(f"Mention ou ID invalide: {target_mention}")
continue
member = message.guild.get_member(user_id)
if not member:
await message.channel.send(f"Utilisateur {target_mention} introuvable.")
continue
try:
# Timeout for duration minutes
await member.timeout(discord.utils.utcnow() + discord.timedelta(minutes=duration), reason=f"Timeout par le Superviseur pour {duration} minutes")
timed_out_count += 1
except discord.Forbidden:
await message.channel.send(f"Je n'ai pas les permissions pour mettre en timeout {member.mention}.")
if timed_out_count > 0:
await message.channel.send(f"{timed_out_count} utilisateur(s) mis en timeout pour {duration} {'minute' if duration == 1 else 'minutes'}.")