Initialisation du repository de Beta
This commit is contained in:
commit
14985f6dbb
9469 changed files with 1903273 additions and 0 deletions
23
commandes/categories/deplacer.py
Normal file
23
commandes/categories/deplacer.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import discord
|
||||
|
||||
async def execute(bot, params, message):
|
||||
categories = params.get('categories', [])
|
||||
if not categories:
|
||||
# Fallback for single category
|
||||
categories = [params]
|
||||
guild = message.guild
|
||||
moved_count = 0
|
||||
for category_params in categories:
|
||||
category_name = category_params.get('category_name')
|
||||
position = category_params.get('position')
|
||||
category = discord.utils.find(lambda cat: cat.name.casefold() == category_name.casefold(), guild.categories)
|
||||
if not category:
|
||||
await message.channel.send(f"Catégorie '{category_name}' introuvable.")
|
||||
continue
|
||||
try:
|
||||
await category.edit(position=position)
|
||||
moved_count += 1
|
||||
except discord.Forbidden:
|
||||
await message.channel.send(f"Je n'ai pas les permissions pour déplacer la catégorie '{category_name}'.")
|
||||
if moved_count > 0:
|
||||
await message.channel.send(f"{moved_count} catégorie(s) déplacée(s).")
|
||||
Loading…
Add table
Add a link
Reference in a new issue