refactored bot code

This commit is contained in:
Hosein
2025-12-30 18:57:48 +03:30
parent 67a76250ab
commit a52d62c0fc
15 changed files with 328 additions and 149 deletions
+18
View File
@@ -0,0 +1,18 @@
import os
import telebot
import logging
from bot.handlers.init import register_all_handlers
logger = logging.getLogger(__name__)
_bot = None
def get_bot():
global _bot
if _bot is None:
BOT_TOKEN = os.environ.get("BOT_TOKEN")
_bot = telebot.TeleBot(BOT_TOKEN, threaded=False)
register_all_handlers(_bot)
logger.info("Telegram bot initialized.")
return _bot