fix(telegram): 优化 bot 启动方式及安装命令逻辑,避免重复安装和卸载 aria2

This commit is contained in:
dnslin
2025-12-12 09:25:25 +08:00
parent e3079ddf0b
commit 084ab6d9b4
2 changed files with 16 additions and 1 deletions

View File

@@ -48,6 +48,8 @@ def create_app(config: BotConfig) -> Application:
def run() -> None:
"""加载配置并启动 bot"""
import asyncio
logger = setup_logger()
config = BotConfig.from_env()
@@ -57,4 +59,11 @@ def run() -> None:
app = create_app(config)
logger.info("Bot starting...")
app.run_polling()
async def main():
async with app:
await app.start()
await app.updater.start_polling()
await asyncio.Event().wait()
asyncio.run(main())