45 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from telegram import Update
from telegram.ext import Application, CommandHandler, CallbackQueryHandler
from handlers import (
user_handlers,
admin_handlers,
database_handlers,
# parse_handlers,
callback_handlers
)
from utils.database import load_database
from utils.database import USER_DATA
from utils.logger import logger
logger.info("Тестовый запуск логов")
def main():
try:
with open(os.getenv('TELEGRAM_TOKEN_FILE'), 'r') as file:
token = file.read().strip()
except FileNotFoundError:
logger.error("Файл с токеном не найден")
return
try:
load_database()
app = Application.builder().token(token).build()
# Регистрация обработчиков
user_handlers.register_handlers(app)
admin_handlers.register_handlers(app)
callback_handlers.register_handlers(app)
# error_handlers.register_handlers(app)
app.run_polling()
except Exception as e:
logger.error(f"Критическая ошибка: {e}")
if __name__ == '__main__':
main()