Fix du système de permissions

This commit is contained in:
Mathis 2026-01-14 21:32:20 +01:00
parent dfec6b2418
commit c330b9a1cc
48 changed files with 4229 additions and 243 deletions

18
bot.py
View file

@ -1,4 +1,6 @@
import discord
from commandes.ticket.utils.permissions import can_access_config
from commandes.ticket.data.storage import get_storage
from discord.ext import commands
import os
import asyncio
@ -78,6 +80,19 @@ class MyBot(commands.Bot):
if await self.is_owner(ctx.author):
return True
# 1b. Bypass pour les commandes de config tickets
# Si la commande est une commande ticket et l'utilisateur a les perms ticket
if ctx.command and (ctx.command.name in ["ticketconfig", "ticketsetup", "configticket"]):
try:
storage = get_storage()
config = storage.load_config(ctx.guild.id)
if can_access_config(ctx, config):
return True
except Exception as e:
kuby_logger.error(f"Error checking ticket permissions in global whitelist: {e}")
# Fallthrough to normal whitelist check if error
# 2. Récupération du Cog
whitelist_cog = self.get_cog("WhitelistMonitor")
if not whitelist_cog:
@ -189,5 +204,4 @@ class MyBot(commands.Bot):
return # Déjà géré dans le whitelist_check
kuby_logger.error(f"Command error in {ctx.command}: {str(error)}", exc_info=True)
bot = MyBot()
bot.run(os.getenv("DISCORD_TOKEN"))
bot = MyBot()