Enhance Telegram bot configuration and error handling
- Updated `.env.example` to include a new `Telegram__ProxyUrl` setting for proxy configuration when accessing the Bot API, improving connectivity options. - Modified `Program.cs` to support proxy settings for the Telegram bot client, allowing for better handling of network restrictions. - Improved error handling in `TelegramBotHostedService` to ensure the bot can recover from network errors without crashing the application, implementing a retry mechanism with a delay. - Added `ProxyUrl` property to `TelegramOptions` for better configuration management.
This commit is contained in:
@@ -43,6 +43,9 @@ Telegram__BotUsername=PnvPanelBot
|
||||
# и получают уведомления о запросах на активацию. Узнать id: @userinfobot.
|
||||
# Не связано с сид-админом выше — привязка Telegram к сид-админу делается вручную в UI.
|
||||
Telegram__AdminTelegramUserIds=123456789
|
||||
# Прокси для запросов к Bot API (обычно socks5://[user:pass@]host:port) — на случай, если Telegram
|
||||
# заблокирован напрямую с сети сервера. Пусто (по умолчанию) — без прокси, прямое подключение.
|
||||
# Telegram__ProxyUrl=socks5://127.0.0.1:39372
|
||||
|
||||
# ── ASP.NET Core ──────────────────────────────────────────────────────────
|
||||
ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
Reference in New Issue
Block a user