5320c9ec20
* Fixed wrong LeveldDebug method calls after moving logic from providers to router * Added independent "IndentFlags" property to inner debugger class * Fixed debug logging in few places * Removed "ICollectingOptions" and merged it with new options abstract "ITelegratorOptions" * Added WebHook version of hosting class
59 lines
2.4 KiB
C#
59 lines
2.4 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
|
|
namespace Telegrator.Hosting.Web
|
|
{
|
|
/// <summary>
|
|
/// Configuration options for Telegram bot behavior and execution settings.
|
|
/// Controls various aspects of bot operation including concurrency, routing, webhook receiving, and execution policies.
|
|
/// </summary>
|
|
public class TelegramBotWebOptions : TelegratorOptions
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets HTTPS URL to send updates to. Use an empty string to remove webhook integration
|
|
/// </summary>
|
|
public required string WebhookUri { get; set; }
|
|
|
|
/// <summary>
|
|
/// A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters.
|
|
/// Only characters A-Z, a-z, 0-9, _ and - are allowed.
|
|
/// The header is useful to ensure that the request comes from a webhook set by you.
|
|
/// </summary>
|
|
public string? SecretToken { get; set; }
|
|
|
|
/// <summary>
|
|
/// The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40.
|
|
/// Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
|
|
/// </summary>
|
|
public int MaxConnections { get; set; } = 40;
|
|
|
|
/// <summary>
|
|
/// Pass true to drop all pending updates
|
|
/// </summary>
|
|
public bool DropPendingUpdates { get; set; }
|
|
|
|
/// <inheritdoc cref="WebApplicationOptions.Args"/>
|
|
public string[]? Args { get; init; }
|
|
|
|
/// <inheritdoc cref="WebApplicationOptions.EnvironmentName"/>
|
|
public string? EnvironmentName { get; init; }
|
|
|
|
/// <inheritdoc cref="WebApplicationOptions.ApplicationName"/>
|
|
public string? ApplicationName { get; init; }
|
|
|
|
/// <inheritdoc cref="WebApplicationOptions.ContentRootPath"/>
|
|
public string? ContentRootPath { get; init; }
|
|
|
|
/// <inheritdoc cref="WebApplicationOptions.WebRootPath"/>
|
|
public string? WebRootPath { get; init; }
|
|
|
|
internal WebApplicationOptions ToWebApplicationOptions() => new WebApplicationOptions()
|
|
{
|
|
ApplicationName = ApplicationName,
|
|
Args = Args,
|
|
ContentRootPath = ContentRootPath,
|
|
EnvironmentName = EnvironmentName,
|
|
WebRootPath = WebRootPath
|
|
};
|
|
}
|
|
}
|