VisionApp/bot.py
Mathis f505b6c552
Some checks failed
CI/CD / lint (push) Failing after 43s
CI/CD / test (push) Successful in 43s
CI/CD / deploy (push) Has been skipped
feat: modmail ticket system with Components V2 + HTML transcripts
- DM-based modmail: user DMs bot -> ticket channel created
- Staff relay: messages in ticket -> DM to user
- Configurable categories via /modmail addcategory
- Setup via /modmail setup (category, staff role, log channel)
- Close command: /close or !close -> HTML transcript generated
- Components V2: Container, TextDisplay, Separator, persistent views
- Transcript: dark theme HTML with staff badges, avatars, timestamps
2026-09-19 15:20:08 +02:00

50 lines
1.6 KiB
Python

import logging
import os
import discord
from discord.ext import commands
import config
logger = logging.getLogger("vision")
DEV_GUILD_IDS = [int(x) for x in os.getenv("DEV_GUILD_IDS", "").split(",") if x.strip()]
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")
await self.load_extension("commandes.modmail")
if config.DEV and DEV_GUILD_IDS:
logger.info(f"Mode DEV — sync des commands sur les guilds: {DEV_GUILD_IDS}")
for guild_id in DEV_GUILD_IDS:
self.tree.copy_global_to(guild=guild_id)
await self.tree.sync(guild=guild_id)
logger.info(f" ✓ Sync guild {guild_id}")
else:
logger.info("Mode PROD — sync global des slash commands...")
await self.tree.sync()
logger.info("Slash commands synchronisées (global)")
async def on_ready(self):
instance = "DEV" if config.DEV else "PROD"
logger.info(f"[{instance}] Connecté en tant que {self.user} (ID: {self.user.id})")
logger.info(f"[{instance}] Serveurs : {len(self.guilds)}")
await self.change_presence(
activity=discord.Activity(
type=discord.ActivityType.watching,
name="Vision Studio",
)
)