Download bot/core/loader.py from AZILS/tgs: direct link, hf CLI and curl.
- Browser
- Download file 999 Bytes
-
https://huggingface.co/spaces/AZILS/tgs/resolve/main/bot/core/loader.py
- Command line
-
hf download hf://spaces/AZILS/tgs/bot/core/loader.py
-
curl -L -o loader.py https://huggingface.co/spaces/AZILS/tgs/resolve/main/bot/core/loader.py
999 Bytes
| from aiogram import Bot, Dispatcher | |
| from aiogram.client.default import DefaultBotProperties | |
| from aiogram.enums import ParseMode | |
| from aiogram.fsm.storage.base import DefaultKeyBuilder | |
| from aiogram.fsm.storage.redis import RedisStorage | |
| from aiogram.utils.i18n.core import I18n | |
| from aiohttp import web | |
| from redis.asyncio import ConnectionPool, Redis | |
| from bot.core.config import DEFAULT_LOCALE, I18N_DOMAIN, LOCALES_DIR, settings | |
| app = web.Application() | |
| token = settings.BOT_TOKEN | |
| bot = Bot(token=token, default=DefaultBotProperties(parse_mode=ParseMode.HTML)) | |
| redis_client = Redis( | |
| connection_pool=ConnectionPool( | |
| host=settings.REDIS_HOST, | |
| port=settings.REDIS_PORT, | |
| password=settings.REDIS_PASS, | |
| db=0, | |
| ), | |
| ) | |
| storage = RedisStorage( | |
| redis=redis_client, | |
| key_builder=DefaultKeyBuilder(with_bot_id=True), | |
| ) | |
| dp = Dispatcher(storage=storage) | |
| i18n: I18n = I18n(path=LOCALES_DIR, default_locale=DEFAULT_LOCALE, domain=I18N_DOMAIN) | |
| DEBUG = settings.DEBUG | |