feat(bot): Telegram через прокси (TELEGRAM_PROXY_URL); лимит памяти бота 384m
С сервера Vobot api.telegram.org недоступен (ни IPv4, ни IPv6) — как и meditron, ходим через прокси; aiohttp-socks для http/socks. Бот в простое ~190 МБ — 256m мало. Refs #12 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+10
-2
@@ -5,6 +5,7 @@ import contextlib
|
||||
import logging
|
||||
|
||||
from aiogram import Bot, Dispatcher
|
||||
from aiogram.client.session.aiohttp import AiohttpSession
|
||||
|
||||
from app import __version__
|
||||
from app.access.service import AccessService
|
||||
@@ -54,8 +55,15 @@ async def run(settings: Settings) -> None:
|
||||
asyncio.create_task(heartbeat(rt.heartbeat_file, rt.heartbeat_interval)),
|
||||
asyncio.create_task(cleanup_loop(sessions)),
|
||||
]
|
||||
bot = Bot(settings.telegram.bot_token.get_secret_value())
|
||||
log.info("tgit %s starting, %d bootstrap admin(s)", __version__, len(settings.access.admin_ids))
|
||||
proxy = settings.telegram.proxy_url
|
||||
session = AiohttpSession(proxy=proxy.get_secret_value()) if proxy else None
|
||||
bot = Bot(settings.telegram.bot_token.get_secret_value(), session=session)
|
||||
log.info(
|
||||
"tgit %s starting, %d bootstrap admin(s), telegram %s",
|
||||
__version__,
|
||||
len(settings.access.admin_ids),
|
||||
"via proxy" if proxy else "direct",
|
||||
)
|
||||
try:
|
||||
await dp.start_polling(bot, handle_signals=True)
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user