Initialisation du repository de Beta
This commit is contained in:
commit
14985f6dbb
9469 changed files with 1903273 additions and 0 deletions
BIN
commandes/salons/__pycache__/creer.cpython-310.pyc
Normal file
BIN
commandes/salons/__pycache__/creer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/creer.cpython-311.pyc
Normal file
BIN
commandes/salons/__pycache__/creer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/creer.cpython-312.pyc
Normal file
BIN
commandes/salons/__pycache__/creer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/deplacer.cpython-310.pyc
Normal file
BIN
commandes/salons/__pycache__/deplacer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/deplacer.cpython-311.pyc
Normal file
BIN
commandes/salons/__pycache__/deplacer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/deplacer.cpython-312.pyc
Normal file
BIN
commandes/salons/__pycache__/deplacer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/modifier.cpython-310.pyc
Normal file
BIN
commandes/salons/__pycache__/modifier.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/modifier.cpython-311.pyc
Normal file
BIN
commandes/salons/__pycache__/modifier.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/modifier.cpython-312.pyc
Normal file
BIN
commandes/salons/__pycache__/modifier.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/renommer.cpython-310.pyc
Normal file
BIN
commandes/salons/__pycache__/renommer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/renommer.cpython-311.pyc
Normal file
BIN
commandes/salons/__pycache__/renommer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/renommer.cpython-312.pyc
Normal file
BIN
commandes/salons/__pycache__/renommer.cpython-312.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/supprimer.cpython-310.pyc
Normal file
BIN
commandes/salons/__pycache__/supprimer.cpython-310.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/supprimer.cpython-311.pyc
Normal file
BIN
commandes/salons/__pycache__/supprimer.cpython-311.pyc
Normal file
Binary file not shown.
BIN
commandes/salons/__pycache__/supprimer.cpython-312.pyc
Normal file
BIN
commandes/salons/__pycache__/supprimer.cpython-312.pyc
Normal file
Binary file not shown.
42
commandes/salons/creer.py
Normal file
42
commandes/salons/creer.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
channels = params.get('channels', [])
|
||||
if not channels:
|
||||
# Fallback for single channel
|
||||
channels = [params]
|
||||
guild = message.guild
|
||||
created_count = 0
|
||||
for channel_params in channels:
|
||||
channel_name = channel_params.get('channel_name')
|
||||
category_name = channel_params.get('category_name')
|
||||
channel_type = channel_params.get('channel_type', 'textuel')
|
||||
if category_name:
|
||||
# Recherche flexible : trouver une catégorie dont le nom contient le terme recherché
|
||||
category = discord.utils.find(
|
||||
lambda cat: category_name.casefold() in cat.name.casefold(),
|
||||
guild.categories
|
||||
)
|
||||
if not category:
|
||||
# Create the category if it doesn't exist
|
||||
try:
|
||||
category = await guild.create_category(category_name)
|
||||
await message.channel.send(f"Catégorie '{category_name}' créée.")
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour créer la catégorie '{category_name}'.")
|
||||
continue
|
||||
else:
|
||||
category = None
|
||||
try:
|
||||
if channel_type.casefold() == 'textuel':
|
||||
channel = await guild.create_text_channel(channel_name, category=category)
|
||||
elif channel_type.casefold() == 'vocal':
|
||||
channel = await guild.create_voice_channel(channel_name, category=category)
|
||||
else:
|
||||
await message.channel.send(f"Type de salon invalide pour '{channel_name}'. Utilisez 'textuel' ou 'vocal'.")
|
||||
continue
|
||||
created_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour créer le salon '{channel_name}'.")
|
||||
if created_count > 0:
|
||||
await message.channel.send(f"{created_count} salon(s) créé(s).")
|
||||
27
commandes/salons/deplacer.py
Normal file
27
commandes/salons/deplacer.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
channels = params.get('channels', [])
|
||||
if not channels:
|
||||
# Fallback for single channel
|
||||
channels = [params]
|
||||
guild = message.guild
|
||||
moved_count = 0
|
||||
for channel_params in channels:
|
||||
channel_name = channel_params.get('channel_name')
|
||||
new_category_name = channel_params.get('new_category_name')
|
||||
channel = discord.utils.find(lambda c: c.name.casefold() == channel_name.casefold(), guild.channels)
|
||||
if not channel:
|
||||
await message.channel.send(f"Salon '{channel_name}' introuvable.")
|
||||
continue
|
||||
category = discord.utils.find(lambda cat: cat.name.casefold() == new_category_name.casefold(), guild.categories)
|
||||
if not category:
|
||||
await message.channel.send(f"Catégorie '{new_category_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await channel.edit(category=category)
|
||||
moved_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour déplacer le salon '{channel_name}'.")
|
||||
if moved_count > 0:
|
||||
await message.channel.send(f"{moved_count} salon(s) déplacé(s).")
|
||||
23
commandes/salons/modifier.py
Normal file
23
commandes/salons/modifier.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
channels = params.get('channels', [])
|
||||
if not channels:
|
||||
# Fallback for single channel
|
||||
channels = [params]
|
||||
guild = message.guild
|
||||
modified_count = 0
|
||||
for channel_params in channels:
|
||||
channel_name = channel_params.get('channel_name')
|
||||
new_name = channel_params.get('new_name')
|
||||
channel = discord.utils.find(lambda c: c.name.casefold() == channel_name.casefold(), guild.channels)
|
||||
if not channel:
|
||||
await message.channel.send(f"Salon '{channel_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await channel.edit(name=new_name)
|
||||
modified_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour modifier le salon '{channel_name}'.")
|
||||
if modified_count > 0:
|
||||
await message.channel.send(f"{modified_count} salon(s) modifié(s).")
|
||||
27
commandes/salons/purge.py
Normal file
27
commandes/salons/purge.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
purges = params.get('purges', [])
|
||||
if not purges:
|
||||
await message.channel.send("Aucune purge spécifiée.")
|
||||
return
|
||||
|
||||
for purge in purges:
|
||||
channel_name = purge.get('channel_name')
|
||||
amount = purge.get('amount', 0)
|
||||
if not channel_name or amount <= 0 or amount > 1000:
|
||||
await message.channel.send(f"Purge invalide: canal '{channel_name}', quantité {amount} (max 1000).")
|
||||
continue
|
||||
|
||||
channel = discord.utils.find(lambda c: c.name == channel_name, message.guild.channels)
|
||||
if not channel or not isinstance(channel, discord.TextChannel):
|
||||
await message.channel.send(f"Canal '{channel_name}' introuvable ou n'est pas un canal texte.")
|
||||
continue
|
||||
|
||||
try:
|
||||
deleted = await channel.purge(limit=amount, reason=f"Purge par {message.author}")
|
||||
await message.channel.send(f"Supprimé {len(deleted)} message(s) dans {channel.mention}.")
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour purger dans {channel.mention}.")
|
||||
except Exception as e:
|
||||
await message.channel.send(f"Erreur lors de la purge dans {channel.mention}: {str(e)}")
|
||||
23
commandes/salons/renommer.py
Normal file
23
commandes/salons/renommer.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
channels = params.get('channels', [])
|
||||
if not channels:
|
||||
# Fallback for single channel
|
||||
channels = [params]
|
||||
guild = message.guild
|
||||
renamed_count = 0
|
||||
for channel_params in channels:
|
||||
channel_name = channel_params.get('channel_name')
|
||||
new_name = channel_params.get('new_name')
|
||||
channel = discord.utils.find(lambda c: c.name.casefold() == channel_name.casefold(), guild.channels)
|
||||
if not channel:
|
||||
await message.channel.send(f"Salon '{channel_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await channel.edit(name=new_name)
|
||||
renamed_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour renommer le salon '{channel_name}'.")
|
||||
if renamed_count > 0:
|
||||
await message.channel.send(f"{renamed_count} salon(s) renommé(s).")
|
||||
22
commandes/salons/supprimer.py
Normal file
22
commandes/salons/supprimer.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
channels = params.get('channels', [])
|
||||
if not channels:
|
||||
# Fallback for single channel
|
||||
channels = [params]
|
||||
guild = message.guild
|
||||
deleted_count = 0
|
||||
for channel_params in channels:
|
||||
channel_name = channel_params.get('channel_name')
|
||||
channel = discord.utils.find(lambda c: c.name.casefold() == channel_name.casefold(), guild.channels)
|
||||
if not channel:
|
||||
await message.channel.send(f"Salon '{channel_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await channel.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 salon '{channel_name}'.")
|
||||
if deleted_count > 0:
|
||||
await message.channel.send(f"{deleted_count} salon(s) supprimé(s).")
|
||||
Loading…
Add table
Add a link
Reference in a new issue