Voice et bot modif

This commit is contained in:
pi 2026-06-16 17:09:34 +00:00
parent 189d56026b
commit 7333a22bcd
10774 changed files with 634644 additions and 933308 deletions

View file

@ -10,13 +10,26 @@ async def execute(bot, params, message):
for removal in role_removals:
target_mention = removal.get('target_user_mention')
role_name = removal.get('role_name')
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), message.guild.roles)
# Try by role_id first if available
role = None
role_id = removal.get('role_id')
if role_id:
try:
role = message.guild.get_role(int(role_id))
except (ValueError, TypeError):
pass
if not role and role_name:
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), message.guild.roles)
if not role:
await message.channel.send(f"Rôle '{role_name}' introuvable.")
label = role_name or removal.get('role_id', 'inconnu')
await message.channel.send(f"Rôle '{label}' introuvable.")
continue
# Check for bulk removal
if target_mention.lower() in ['@everyone', 'everyone', 'all', 'tous']:
if target_mention and target_mention.lower() in ['@everyone', 'everyone', 'all', 'tous']:
total_members = 0
removed_count = 0
await message.channel.send(f"Retrait du rôle '{role.name}' de tous les membres... (Cela peut prendre du temps)")
@ -39,6 +52,10 @@ async def execute(bot, params, message):
await message.channel.send(f"Rôle '{role.name}' retiré à {removed_count} membres (bots exclus).")
continue
if not target_mention:
await message.channel.send("Mention utilisateur requise.")
continue
# Single user removal
if target_mention.startswith('<@') and target_mention.endswith('>'):
user_id = int(target_mention[2:-1])
@ -68,4 +85,4 @@ async def execute(bot, params, message):
except discord.Forbidden:
await message.channel.send(f"Je n'ai pas les permissions pour retirer le rôle {role.name} de {member.mention}.")
if removed_count > 0 and not total_members:
await message.channel.send(f"{removed_count} rôle(s) retiré(s).")
await message.channel.send(f"{removed_count} rôle(s) retiré(s).")