Telegrator 1.18.5.2

dotnet add package Telegrator --version 1.18.5.2
                    
NuGet\Install-Package Telegrator -Version 1.18.5.2
                    
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="Telegrator" Version="1.18.5.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Telegrator" Version="1.18.5.2" />
                    
Directory.Packages.props
<PackageReference Include="Telegrator" />
                    
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 Telegrator --version 1.18.5.2
                    
#r "nuget: Telegrator, 1.18.5.2"
                    
#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 Telegrator@1.18.5.2
                    
#: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=Telegrator&version=1.18.5.2
                    
Install as a Cake Addin
#tool nuget:?package=Telegrator&version=1.18.5.2
                    
Install as a Cake Tool

Telegrator (Core)

The heart of the Telegrator framework. Provides the mediator-based update routing system, aspect-oriented handlers, declarative filters, state management, and the awaiting mechanism.


📦 What's Inside

Handlers

Independent, aspect-oriented modules that process Telegram updates. Each handler is a class that inherits from a base handler type (e.g., MessageHandler, CommandHandler, CallbackQueryHandler) and overrides the Execute method.

[MessageHandler]
[TextContains("hello")]
public class HelloHandler : MessageHandler
{
    public override async Task<Result> Execute(IHandlerContainer<Message> container, CancellationToken cancellation)
    {
        await Reply($"Hello, {container.ActualUpdate.From?.FirstName}!");
        return Ok;
    }
}

Filters

Declarative conditions that determine whether a handler should process an update. Filters are defined as attributes and evaluated by the mediator before handler execution.

Built-in filters include:

  • TextContains, TextStartsWith, TextEndsWith
  • CommandAllias
  • ChatType
  • CallbackData, CallbackDataStartsWith
  • Regex-based filters
  • Custom filters via Filter<T>.If(...)

Routing & Mediation

The UpdateRouter dispatches incoming updates to appropriate handlers. It supports:

  • Awaiting handlers — temporary handlers that wait for a specific follow-up update
  • Regular handlers — persistent handlers registered at startup
  • Exclusive awaiting routing — option to block regular handlers when awaiting handlers are active
  • Bounded channel backpressureUpdateHandlersPool uses Channel.CreateBounded with configurable capacity

Result Pattern

Handlers return a lightweight readonly record struct Result to control routing:

  • Result.Ok() — handler succeeded, stop routing
  • Result.Fault() — handler failed, stop routing
  • Result.Next() — handler skipped, continue to next handler
  • Result.Next<T>() — route to a specific handler type

State Management

Store and retrieve user/chat state without manual state machines.

await StateStorage.GetStateMachine<SetupWizard>(HandlingUpdate).BySenderId().Advance(cancellation);

Awaiting Mechanism

Pause handler execution and wait for the user's next message inline.

await Reply("What is your name?");
var nextMessage = await AwaitingProvider.AwaitMessage(HandlingUpdate).BySenderId(cancellation);
await Reply($"Hello, {nextMessage.Text}!");

OpenTelemetry Integration

Automatic ActivitySource spans for:

  • Telegrator.UpdateRouterHandleUpdate span with update.id and update.type tags
  • Telegrator.UpdateHandlersPoolProcessHandler span with handler and update tags

🔧 Configuration

var options = new TelegratorOptions
{
    Token = "<YOUR_BOT_TOKEN>",
    MaximumParallelWorkingHandlers = 10,   // Bounded channel capacity = 20
    ExclusiveAwaitingHandlerRouting = false
};

var bot = new TelegratorClient(options);

Package Purpose
Telegrator.Hosting .NET Generic Host integration
Telegrator.Hosting.Web ASP.NET Core webhook support
Telegrator.Analyzers Source generators for AOT
Telegrator.Testing Unit & integration test utilities

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Telegrator:

Package Downloads
Telegrator.Hosting

Package Description

Telegrator.RedisStateStorage

Package Description

Telegartor.RedisStateStorage

Package Description

Telegrator.Localized

Package Description

Telegrator.Testing

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.18.5.2 149 6/7/2026
1.18.5.1 177 6/3/2026
1.18.5 175 6/2/2026
1.18.4.3 158 6/2/2026
1.18.4.2 155 6/2/2026
1.18.4.1 165 6/2/2026
1.18.4 167 6/1/2026
1.18.3 169 5/28/2026
1.18.2 168 5/26/2026
1.18.1 165 5/25/2026
1.18.0 209 5/24/2026
1.17.3.1 98 5/22/2026
1.17.3 209 5/22/2026
1.17.1 130 5/1/2026
1.17.0 127 4/27/2026
1.16.9 123 4/23/2026
1.16.8 146 4/3/2026
1.16.7 145 3/15/2026
1.16.6 178 3/15/2026
1.16.5 167 3/9/2026
Loading failed