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:
@@ -8,6 +8,9 @@ public sealed class TelegramOptions
|
||||
public string? BotUsername { get; init; }
|
||||
public string PublicSiteUrl { get; init; } = string.Empty;
|
||||
|
||||
/// <summary>Прокси для запросов к Bot API (обычно socks5://[user:pass@]host:port). Пусто — без прокси.</summary>
|
||||
public string? ProxyUrl { get; init; }
|
||||
|
||||
/// <summary>Telegram id админов (через запятую) — авторизуют админ-кнопки в боте.</summary>
|
||||
public string? AdminTelegramUserIds { get; init; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user