Migration de Kuby vers disnake
This commit is contained in:
parent
dc6e235f27
commit
c8c579eefe
36 changed files with 1205 additions and 1253 deletions
16
bot.py
16
bot.py
|
|
@ -4,10 +4,10 @@ from dotenv import load_dotenv
|
|||
# Charger les variables d'environnement AVANT tout le reste
|
||||
load_dotenv()
|
||||
|
||||
import discord
|
||||
import disnake
|
||||
from commandes.ticket.utils.permissions import can_access_config
|
||||
from commandes.ticket.data.storage import get_storage
|
||||
from discord.ext import commands
|
||||
from disnake.ext import commands
|
||||
import asyncio
|
||||
from src.logger import kuby_logger, log_performance
|
||||
import logging
|
||||
|
|
@ -25,12 +25,12 @@ except ValueError:
|
|||
kuby_logger.error(f"❌ APPLICATION_ID invalide : {application_id_raw}")
|
||||
application_id = None
|
||||
|
||||
# Configuration des intents Discord
|
||||
intents = discord.Intents.default()
|
||||
# Configuration des intents Disnake
|
||||
intents = disnake.Intents.default()
|
||||
intents.message_content = True
|
||||
intents.members = True
|
||||
intents.voice_states = True
|
||||
kuby_logger.debug(f"Discord intents configured: {intents}")
|
||||
kuby_logger.debug(f"Disnake intents configured: {intents}")
|
||||
|
||||
class MyBot(commands.Bot):
|
||||
def __init__(self):
|
||||
|
|
@ -135,7 +135,7 @@ class MyBot(commands.Bot):
|
|||
# Réponse adaptée (Slash vs Message)
|
||||
msg = "❌ Vous n'êtes pas autorisé à utiliser cette commande. Veuillez demander à être ajouté à la whitelist."
|
||||
if ctx.interaction:
|
||||
await ctx.interaction.response.send_message(msg, ephemeral=True)
|
||||
await ctx.send(msg, ephemeral=True)
|
||||
else:
|
||||
await ctx.send(msg)
|
||||
return False
|
||||
|
|
@ -147,8 +147,8 @@ class MyBot(commands.Bot):
|
|||
|
||||
# Sync slash commands
|
||||
try:
|
||||
await self.tree.sync()
|
||||
kuby_logger.info("✅ Commandes slash synchronisées avec Discord")
|
||||
# Disnake handles syncing automatically by default
|
||||
kuby_logger.info("✅ Commandes slash prêtes avec Disnake")
|
||||
except Exception as e:
|
||||
kuby_logger.error(f"❌ Erreur lors de la synchronisation des commandes slash : {e}", exc_info=True)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue