Initialisation du repository de Beta
This commit is contained in:
commit
14985f6dbb
9469 changed files with 1903273 additions and 0 deletions
BIN
commandes/roles/__pycache__/add_role.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/add_role.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/add_role.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/add_role.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/creer.cpython-310.pyc
Normal file
BIN
commandes/roles/__pycache__/creer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/creer.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/creer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/creer.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/creer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/deplacer.cpython-310.pyc
Normal file
BIN
commandes/roles/__pycache__/deplacer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/deplacer.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/deplacer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/deplacer.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/deplacer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/modifier.cpython-310.pyc
Normal file
BIN
commandes/roles/__pycache__/modifier.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/modifier.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/modifier.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/remove_role.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/remove_role.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/remove_role.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/remove_role.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/renommer.cpython-310.pyc
Normal file
BIN
commandes/roles/__pycache__/renommer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/renommer.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/renommer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/renommer.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/renommer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/supprimer.cpython-310.pyc
Normal file
BIN
commandes/roles/__pycache__/supprimer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/supprimer.cpython-311.pyc
Normal file
BIN
commandes/roles/__pycache__/supprimer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/roles/__pycache__/supprimer.cpython-312.pyc
Normal file
BIN
commandes/roles/__pycache__/supprimer.cpython-312.pyc
Normal file
Binary file not shown.
62
commandes/roles/add_role.py
Normal file
62
commandes/roles/add_role.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
role_assignments = params.get('role_assignments', [])
|
||||
if not role_assignments:
|
||||
# Fallback for single assignment
|
||||
role_assignments = [params]
|
||||
assigned_count = 0
|
||||
total_members = 0
|
||||
for assignment in role_assignments:
|
||||
target_mention = assignment.get('target_user_mention')
|
||||
role_name = assignment.get('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.")
|
||||
continue
|
||||
|
||||
# Check for bulk assignment
|
||||
if target_mention.lower() in ['@everyone', 'everyone', 'all', 'tous']:
|
||||
total_members = 0
|
||||
assigned_count = 0
|
||||
await message.channel.send(f"Ajout du rôle '{role.name}' à tous les membres... (Cela peut prendre du temps)")
|
||||
for member in message.guild.members:
|
||||
if member.bot:
|
||||
continue # Skip bots
|
||||
try:
|
||||
await member.add_roles(role, reason=f"Rôle ajouté par le Superviseur à tous les membres")
|
||||
assigned_count += 1
|
||||
total_members += 1
|
||||
if assigned_count % 10 == 0: # Progress update every 10 assigns
|
||||
await message.channel.send(f"Progression: {assigned_count} sur {total_members} membres...")
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Impossible d'ajouter le rôle à {member.mention} (permissions insuffisantes)")
|
||||
continue
|
||||
except Exception as e:
|
||||
await message.channel.send(f"Erreur lors de l'ajout à {member.mention}: {str(e)}")
|
||||
continue
|
||||
await message.channel.send(f"Rôle '{role.name}' ajouté à {assigned_count} membres (bots exclus).")
|
||||
continue
|
||||
|
||||
# Single user assignment
|
||||
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])
|
||||
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:
|
||||
await member.add_roles(role, reason=f"Rôle ajouté par le Superviseur")
|
||||
assigned_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour ajouter le rôle {role.name} à {member.mention}.")
|
||||
if assigned_count > 0 and not total_members:
|
||||
await message.channel.send(f"{assigned_count} rôle(s) ajouté(s).")
|
||||
32
commandes/roles/creer.py
Normal file
32
commandes/roles/creer.py
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
roles = params.get('roles', [])
|
||||
if not roles:
|
||||
# Fallback for single role
|
||||
roles = [params]
|
||||
guild = message.guild
|
||||
created_count = 0
|
||||
for role_params in roles:
|
||||
role_name = role_params.get('role_name')
|
||||
color = role_params.get('color', '#ffffff')
|
||||
permissions_str = role_params.get('permissions', '')
|
||||
# Parse color
|
||||
try:
|
||||
color = discord.Color(int(color.lstrip('#'), 16))
|
||||
except ValueError:
|
||||
color = discord.Color.default()
|
||||
# Parse permissions
|
||||
permissions = discord.Permissions()
|
||||
if permissions_str:
|
||||
perm_list = [p.strip() for p in permissions_str.split(',')]
|
||||
for perm in perm_list:
|
||||
if hasattr(discord.Permissions, perm):
|
||||
setattr(permissions, perm, True)
|
||||
try:
|
||||
role = await guild.create_role(name=role_name, color=color, permissions=permissions)
|
||||
created_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour créer le rôle '{role_name}'.")
|
||||
if created_count > 0:
|
||||
await message.channel.send(f"{created_count} rôle(s) créé(s).")
|
||||
23
commandes/roles/deplacer.py
Normal file
23
commandes/roles/deplacer.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
roles = params.get('roles', [])
|
||||
if not roles:
|
||||
# Fallback for single role
|
||||
roles = [params]
|
||||
guild = message.guild
|
||||
moved_count = 0
|
||||
for role_params in roles:
|
||||
role_name = role_params.get('role_name')
|
||||
position = role_params.get('position')
|
||||
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), guild.roles)
|
||||
if not role:
|
||||
await message.channel.send(f"Rôle '{role_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await role.edit(position=position)
|
||||
moved_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour déplacer le rôle '{role_name}'.")
|
||||
if moved_count > 0:
|
||||
await message.channel.send(f"{moved_count} rôle(s) déplacé(s).")
|
||||
23
commandes/roles/modifier.py
Normal file
23
commandes/roles/modifier.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
roles = params.get('roles', [])
|
||||
if not roles:
|
||||
# Fallback for single role
|
||||
roles = [params]
|
||||
guild = message.guild
|
||||
modified_count = 0
|
||||
for role_params in roles:
|
||||
role_name = role_params.get('role_name')
|
||||
new_name = role_params.get('new_name')
|
||||
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), guild.roles)
|
||||
if not role:
|
||||
await message.channel.send(f"Rôle '{role_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await role.edit(name=new_name)
|
||||
modified_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour modifier le rôle '{role_name}'.")
|
||||
if modified_count > 0:
|
||||
await message.channel.send(f"{modified_count} rôle(s) modifié(s).")
|
||||
71
commandes/roles/remove_role.py
Normal file
71
commandes/roles/remove_role.py
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
role_removals = params.get('role_removals', [])
|
||||
if not role_removals:
|
||||
# Fallback for single removal
|
||||
role_removals = [params]
|
||||
removed_count = 0
|
||||
total_members = 0
|
||||
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)
|
||||
if not role:
|
||||
await message.channel.send(f"Rôle '{role_name}' introuvable.")
|
||||
continue
|
||||
|
||||
# Check for bulk removal
|
||||
if 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)")
|
||||
for member in message.guild.members:
|
||||
if member.bot:
|
||||
continue # Skip bots
|
||||
if role in member.roles:
|
||||
try:
|
||||
await member.remove_roles(role, reason=f"Rôle retiré par le Superviseur de tous les membres")
|
||||
removed_count += 1
|
||||
total_members += 1
|
||||
if removed_count % 10 == 0: # Progress update every 10 removes
|
||||
await message.channel.send(f"Progression: {removed_count} sur {total_members} membres...")
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Impossible de retirer le rôle de {member.mention} (permissions insuffisantes)")
|
||||
continue
|
||||
except Exception as e:
|
||||
await message.channel.send(f"Erreur lors du retrait à {member.mention}: {str(e)}")
|
||||
continue
|
||||
await message.channel.send(f"Rôle '{role.name}' retiré à {removed_count} membres (bots exclus).")
|
||||
continue
|
||||
|
||||
# Single user removal
|
||||
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:
|
||||
await member.remove_roles(role, reason=f"Rôle retiré par le Superviseur")
|
||||
removed_count += 1
|
||||
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).")
|
||||
23
commandes/roles/renommer.py
Normal file
23
commandes/roles/renommer.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
roles = params.get('roles', [])
|
||||
if not roles:
|
||||
# Fallback for single role
|
||||
roles = [params]
|
||||
guild = message.guild
|
||||
renamed_count = 0
|
||||
for role_params in roles:
|
||||
role_name = role_params.get('role_name')
|
||||
new_name = role_params.get('new_name')
|
||||
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), guild.roles)
|
||||
if not role:
|
||||
await message.channel.send(f"Rôle '{role_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await role.edit(name=new_name)
|
||||
renamed_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour renommer le rôle '{role_name}'.")
|
||||
if renamed_count > 0:
|
||||
await message.channel.send(f"{renamed_count} rôle(s) renommé(s).")
|
||||
22
commandes/roles/supprimer.py
Normal file
22
commandes/roles/supprimer.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
roles = params.get('roles', [])
|
||||
if not roles:
|
||||
# Fallback for single role
|
||||
roles = [params]
|
||||
guild = message.guild
|
||||
deleted_count = 0
|
||||
for role_params in roles:
|
||||
role_name = role_params.get('role_name')
|
||||
role = discord.utils.find(lambda r: r.name.casefold() == role_name.casefold(), guild.roles)
|
||||
if not role:
|
||||
await message.channel.send(f"Rôle '{role_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await role.delete(reason="Supprimé par le Superviseur")
|
||||
deleted_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour supprimer le rôle '{role_name}'.")
|
||||
if deleted_count > 0:
|
||||
await message.channel.send(f"{deleted_count} rôle(s) supprimé(s).")
|
||||
Loading…
Add table
Add a link
Reference in a new issue