forked from sdfgames342-lgtm/Hibryd_bots-LEGACY
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (28 loc) · 905 Bytes
/
main.py
File metadata and controls
31 lines (28 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python3
import logging
import sys
from config import DEBUG
from database.db import db
from core.bot import bot_instance
from core.loader import load_all_plugins
logging.basicConfig(
level=logging.DEBUG if DEBUG else logging.INFO,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
logger = logging.getLogger(__name__)
def main():
logger.info("Iniciando el bot...")
load_all_plugins()
logger.info("Plugins y addons cargados.")
# El dispatcher único ya está registrado en core.bot, no hace falta apply_handlers
logger.info("Handlers registrados (dispatcher único).")
try:
bot_instance.start_polling()
except KeyboardInterrupt:
logger.info("Bot detenido por el usuario.")
sys.exit(0)
except Exception as e:
logger.critical(f"Error fatal: {e}")
sys.exit(1)
if __name__ == "__main__":
main()