VisionApp/bot.py

38 lines
1 KiB
Python
Raw Normal View History

import logging
import discord
from discord.ext import commands
import config
logger = logging.getLogger("vision")
class VisionBot(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True
intents.members = True
super().__init__(
command_prefix="!",
intents=intents,
application_id=config.APPLICATION_ID,
)
async def setup_hook(self):
logger.info("Chargement des cogs...")
await self.load_extension("commandes.hello")
logger.info("Sync des slash commands...")
await self.tree.sync()
logger.info("Slash commands synchronisées")
async def on_ready(self):
logger.info(f"Connecté en tant que {self.user} (ID: {self.user.id})")
logger.info(f"Serveurs : {len(self.guilds)}")
await self.change_presence(
activity=discord.Activity(
type=discord.ActivityType.watching,
name="Vision Studio",
)
)