Dot0.TelegramBot
10.6.7
See the version list below for details.
dotnet add package Dot0.TelegramBot --version 10.6.7
NuGet\Install-Package Dot0.TelegramBot -Version 10.6.7
<PackageReference Include="Dot0.TelegramBot" Version="10.6.7" />
<PackageVersion Include="Dot0.TelegramBot" Version="10.6.7" />
<PackageReference Include="Dot0.TelegramBot" />
paket add Dot0.TelegramBot --version 10.6.7
#r "nuget: Dot0.TelegramBot, 10.6.7"
#:package Dot0.TelegramBot@10.6.7
#addin nuget:?package=Dot0.TelegramBot&version=10.6.7
#tool nuget:?package=Dot0.TelegramBot&version=10.6.7
Dot0.TelegramBot
Telegram bot utilities for .NET 10, including command serialization, update handlers, polling/forwarding helpers, chat state and reusable client creation. The client factory uses Telegram.Bot and the existing ASP.NET Core framework reference for HTTP registration; it has no dependency on Axon or other Dot0 modules.
Keep XML documentation on all public types, properties, constructors, methods and constants. The package includes XML documentation and this README.
Client registration and creation
using Dot0.TelegramBot;
using System.Net;
services.AddTelegram(options =>
{
options.BaseUrl = "https://api.telegram.org";
options.UseTestEnvironment = false;
options.Timeout = TimeSpan.FromSeconds(90);
options.PooledConnectionLifetime = TimeSpan.FromMinutes(2);
// Optional forward proxy. Credentials may be omitted when not needed.
options.Proxy = new WebProxy("socks5://localhost:1080")
{
Credentials = new NetworkCredential(proxyUsername, proxyPassword),
};
});
The delegate configures TelegramClientOptions once during registration. Callers do not construct TelegramBotClientOptions. Registration validates and captures the settings and returns an IHttpClientBuilder for additional HTTP configuration. This overload registers TelegramClientFactory as a singleton ITelegramClientFactory and also registers the existing update poller without starting it. The parameterless AddTelegram overload uses the same registration with default options.
Inject ITelegramClientFactory and supply each bot's token when creating a client:
var client = factory.Create(botToken);
var bot = await client.GetMe(cancellationToken);
One registration supports multiple bots. Create accepts an optional global cancellation token for the returned client. Telegram.Bot owns token validation.
Polling by bot token
Inject ITelegramBotUpdatePoller and start with either an existing TelegramBotClient or a bot token:
await poller.StartAsync(botToken, updateForwardAddress, secretToken: secretToken);
The token overload creates the client through ITelegramClientFactory, then calls the client overload with the same forwarding address, secret, serializer options and callbacks. Stop polling through StopAsync(botToken).
Shared options and HTTP ownership
- BaseUrl defaults to null, selecting Telegram's public API. Explicit HTTP(S) URLs may contain a relay path prefix, preserved for API calls and downloads. URLs must not contain credentials, a query or a fragment.
- UseTestEnvironment defaults to false and controls the SDK's test URL suffix.
- RetryThreshold and RetryCount configure the SDK's existing rate-limit retry behavior. Their defaults are 60 seconds and three attempts; RetryThreshold zero disables those automatic retries.
- Proxy accepts a standard IWebProxy, such as WebProxy with an HTTP or SOCKS address and optional credentials. Null retains platform default proxy behavior. BaseUrl and Proxy configure the API destination and network proxy independently.
- Timeout defaults to 90 seconds; PooledConnectionLifetime defaults to two minutes. Both accept Timeout.InfiniteTimeSpan.
- AddHttpClient manages the shared handler pool. Cookies, automatic redirects and factory HTTP logging are disabled. Each SDK client owns its token; shared HTTP headers and registration settings contain no bot credentials.
Hosts own listener startup, callbacks, application state and authorization. ChatStateManager must be registered separately when needed; its cache is not durable conversation history or an application isolation boundary.
Build, checks and publishing
From the repository root:
dotnet run --project TelegramBot.Client.Tests/TelegramBot.Client.Tests.csproj --configuration Release
dotnet pack TelegramBot/TelegramBot.csproj --configuration Release --no-build --output ./nupkg -p:PackageVersion=10.6.0
The client checks run offline with real SDK calls intercepted by HTTP test doubles. They cover settings validation and capture, factory/poller registration, per-bot tokens, proxy settings, connection sharing, relay prefixes, downloads and SDK retry settings. TelegramBot.Test remains the existing web application sample; running it starts its configured host and polling.
The existing .github/workflows/deploy-telegram-bot.yml builds and checks the
library before publishing Dot0.TelegramBot as 10.6.<GitHub run number>.
Its deployment branch remains deploy-telegram-bot; manual dispatch is supported.
Use the existing package's NuGet Trusted Publishing setup.
The client factory is part of this package; there is no separate Telegram package.
Source changes do not establish NuGet publication or deployment.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Telegram.Bot (>= 22.10.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.6.8 | 0 | 11/19/2026 |
| 10.6.7 | 44 | 11/18/2026 |
| 10.6.6 | 107 | 11/7/2026 |
| 10.6.4 | 328 | 10/19/2026 |
| 10.6.3 | 102 | 10/11/2026 |
| 10.5.2 | 111 | 9/16/2026 |
| 10.5.1 | 127 | 9/10/2026 |
| 10.2.9 | 199 | 7/30/2026 |
| 10.2.8 | 156 | 7/26/2026 |
| 10.2.7 | 163 | 6/30/2026 |
| 10.2.6 | 133 | 6/30/2026 |
| 10.2.5 | 129 | 6/30/2026 |
| 10.2.4 | 138 | 6/30/2026 |
| 10.2.3 | 125 | 6/30/2026 |
| 10.2.2 | 125 | 6/30/2026 |
| 10.2.1 | 129 | 6/30/2026 |
| 10.2.0 | 133 | 6/30/2026 |
| 10.1.1 | 141 | 6/23/2026 |
| 10.1.0 | 135 | 5/29/2026 |