using Telegram.Bot;
namespace Telegrator.Hosting.Configuration
{
///
/// Internal proxy class for configuring Telegram bot client options from configuration.
/// Extends ConfigureOptionsProxy to provide specific configuration for Telegram bot client options.
///
public class TelegramBotClientOptionsProxy : ConfigureOptionsProxy
{
///
/// Gets or sets the bot token.
///
public string Token { get; set; } = string.Empty;
///
/// Gets or sets the base URL for the bot API.
///
public string? BaseUrl { get; set; } = null;
///
/// Gets or sets whether to use the test environment.
///
public bool UseTestEnvironment { get; set; } = false;
///
/// Gets or sets the retry threshold in seconds.
///
public int RetryThreshold { get; set; } = 60;
///
/// Gets or sets the number of retry attempts.
///
public int RetryCount { get; set; } = 3;
///
/// Creates a TelegramBotClientOptions instance from the proxy configuration.
///
/// The configured TelegramBotClientOptions instance.
protected override TelegramBotClientOptions Realize() => new TelegramBotClientOptions(Token, BaseUrl, UseTestEnvironment)
{
RetryCount = RetryCount,
RetryThreshold = RetryThreshold
};
}
}