Apckeyl_RealESRGAN / telegram_bot.py
evgeniy778's picture
Update telegram_bot.py
e8dfd19 verified
Raw
History Blame Contribute Delete
1.47 kB
# =====================================================
# Apckeyl Framework
# Version 2.1
# telegram_bot.py
# =====================================================
"""
Telegram Bot.
Точка входа Telegram Framework.
Version 2.0
"""
import os
import asyncio
from aiogram import Bot
from aiogram import Dispatcher
from telegram_controller import TelegramController
# -----------------------------------------------------
# Telegram Secrets
# -----------------------------------------------------
BOT_TOKEN = os.getenv(
"BOT_TOKEN"
)
if not BOT_TOKEN:
raise RuntimeError(
"BOT_TOKEN not found in Hugging Face Secrets."
)
# -----------------------------------------------------
# Telegram Objects
# -----------------------------------------------------
bot = Bot(
token=BOT_TOKEN,
)
dispatcher = Dispatcher()
controller = TelegramController(
bot=bot,
dispatcher=dispatcher,
)
# -----------------------------------------------------
# Main
# -----------------------------------------------------
async def main():
print()
print("====================================")
print("Apckeyl Telegram Framework")
print("Version 2.1")
print("====================================")
print()
print("BOT_TOKEN loaded successfully.")
await controller.start()
# -----------------------------------------------------
if __name__ == "__main__":
asyncio.run(
main()
)