- .env.dev / .env.prod with separate tokens and APPLICATION_ID - Bot syncs commands to specific guild in dev mode - Global sync for production - Updated .forgejo/workflows/ci.yml with SSH deploy to prod server - Updated .gitignore for .env.dev / .env.prod
40 lines
981 B
Python
40 lines
981 B
Python
import asyncio
|
|
import logging
|
|
import sys
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
import config
|
|
from bot import VisionBot
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(asctime)s | %(levelname)-8s | %(name)s — %(message)s",
|
|
datefmt="%Y-%m-%d %H:%M:%S",
|
|
handlers=[
|
|
logging.StreamHandler(sys.stdout),
|
|
logging.FileHandler(config.LOGS_DIR / "vision.log", encoding="utf-8"),
|
|
],
|
|
)
|
|
logger = logging.getLogger("vision")
|
|
|
|
|
|
async def main():
|
|
if not config.DISCORD_TOKEN:
|
|
logger.critical("DISCORD_TOKEN manquant dans .env")
|
|
sys.exit(1)
|
|
|
|
instance = "DEV" if config.DEV else "PROD"
|
|
logger.info(f"Lancement de Vision Studio [{instance}]...")
|
|
bot = VisionBot()
|
|
|
|
try:
|
|
await bot.start(config.DISCORD_TOKEN)
|
|
except KeyboardInterrupt:
|
|
logger.info("Arrêt demandé")
|
|
except Exception as e:
|
|
logger.critical(f"Erreur fatale : {e}", exc_info=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|