cnet.testing 1.7.0

dotnet add package cnet.testing --version 1.7.0
                    
NuGet\Install-Package cnet.testing -Version 1.7.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="cnet.testing" Version="1.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="cnet.testing" Version="1.7.0" />
                    
Directory.Packages.props
<PackageReference Include="cnet.testing" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add cnet.testing --version 1.7.0
                    
#r "nuget: cnet.testing, 1.7.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package cnet.testing@1.7.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=cnet.testing&version=1.7.0
                    
Install as a Cake Addin
#tool nuget:?package=cnet.testing&version=1.7.0
                    
Install as a Cake Tool

cnet

cnet

CI NuGet Downloads License .NET 9 Bot API 10.1

Telegram bot toolkit for .NET 9 — strongly typed handlers, built-in flood control and automatic retry, sessions and FSM, media-group aggregation, long polling, and hardened webhooks.

Quick start

var builder = Host.CreateApplicationBuilder(args);

builder.Services
    .AddCnet(options => options.BotToken = builder.Configuration["BotToken"]!)
    .UseReplayGuard()
    .OnCommand("start", async cmd =>
    {
        var keyboard = Keyboard.Inline()
            .Row().Callback("Help", "help").Url("Site", "https://example.com")
            .Build();

        await cmd.ReplyAsync("<b>Hello!</b>", keyboard);
    })
    .OnCallback("help", async cb =>
    {
        await cb.AnswerAsync();
        await cb.EditTextAsync("Help text");
    })
    .OnMessage(async msg =>
    {
        await msg.TypingAsync();
        await msg.ReplyQuotedAsync("Echo: " + msg.Text);
    })
    .UsePolling();

await builder.Build().RunAsync();

For webhooks, add the cnet.aspnetcore package:

builder.Services.AddCnetWebhook(options =>
{
    options.PublicUrl = "https://bot.example.com";
    options.Path = "/telegram/webhook";
    options.SecretToken = configuration["WebhookSecret"]!;
});

app.MapCnetWebhook();

Highlights

  • Typed turns: command, callback, message, and album handlers each receive a dedicated context with exactly the operations that interaction supports
  • Automatic retry on 429 (retry_after respected) and transient network errors
  • Proactive outbound throttle: 30 msg/s global, 1 msg/s per chat, on by default
  • Sessions and FSM with OnState(...) routing and pluggable storage
  • Media-group aggregation: whole albums arrive as one event
  • Inbound per-user rate limiting, replay protection, global error hook
  • Class-based handlers with constructor injection
  • Bounded update queue with backpressure and graceful shutdown
  • Wrappers for every common send and management operation, plus ctx.Bot for direct IntelliSense access to all 180+ Bot API 10.1 methods (rich messages, guardian bots, gifts, business accounts) with the same retry policy

Documentation

License

Released under the MIT License. Telegram is a trademark of Telegram FZ-LLC; this project is independent and not affiliated with or endorsed by Telegram.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.7.0 125 7/9/2026