Telegrator 1.15.9
dotnet add package Telegrator --version 1.15.9
NuGet\Install-Package Telegrator -Version 1.15.9
<PackageReference Include="Telegrator" Version="1.15.9" />
<PackageVersion Include="Telegrator" Version="1.15.9" />
<PackageReference Include="Telegrator" />
paket add Telegrator --version 1.15.9
#r "nuget: Telegrator, 1.15.9"
#:package Telegrator@1.15.9
#addin nuget:?package=Telegrator&version=1.15.9
#tool nuget:?package=Telegrator&version=1.15.9
Telegrator
A modern reactive framework for Telegram bots in C# with aspect-oriented design, mediator-based dispatching, and flexible architecture.
🚀 About Telegrator
Telegrator is a next-generation framework for building Telegram bots in C#, inspired by AOP (Aspect-Oriented Programming) and the mediator pattern. It enables decentralized, easily extensible, and maintainable bot logic without traditional state machines or monolithic handlers.
✨ Key Features
- Aspect-oriented approach: Handlers and filters are "aspects" of the bot, easily composable and extendable.
- Decentralized logic: Each handler is an independent module—no more giant switch/case blocks.
- Mediator-based dispatching: All updates are routed through a powerful mediator-dispatcher.
- Flexible filtering: Filters for commands, text, sender, chat, regex, and much more.
- Execution order and priorities: Easily control handler priorities and execution order.
- Thread safety and concurrency control: Limit the number of concurrent handlers, await other updates inside a handler.
- Extensibility via attributes and providers: Easily add your own filters, handlers, and state keepers.
- Minimal boilerplate—maximum declarativity!
🧩 Architecture & Approach
- Decentralization: Bot logic is split into independent handlers (aspects), each responsible for its own part.
- Mediator: All Telegram updates go through a mediator, which decides which handlers should process them and in what order.
- Filters: Describe handler trigger conditions in a flexible, declarative way.
- State: Built-in mechanisms for user/chat state without manual state machines.
🛠️ Quick Start
1. Installation
# .NET CLI
dotnet add package Telegrator
# NuGet CLI
NuGet\Install-Package Telegrator
2. Minimal Bot Example
using Telegrator.Handlers;
using Telegrator.Annotations;
[MessageHandler]
public class HelloHandler : MessageHandler
{
public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{
await Reply("Hello, world!", cancellationToken: cancellation);
return Result.Ok();
}
}
// Registration and launch:
var bot = new TelegratorClient("<YOUR_BOT_TOKEN>");
bot.Handlers.AddHandler<HelloHandler>();
bot.StartReceiving();
3. Adding Filtering and Commands
using Telegram.Bot.Types.Enums;
using Telegrator.Handlers;
using Telegrator.Annotations;
[CommandHandler, CommandAllias("start", "hello"), ChatType(ChatType.Private)]
public class StartCommandHandler : CommandHandler
{
public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{
await Responce("Welcome!", cancellationToken: cancellation);
return Result.Ok();
}
}
// Registration:
bot.Handlers.AddHandler<StartCommandHandler>();
4. State Management Example
using Telegrator.Handlers;
using Telegrator.Annotations;
[CommandHandler, CommandAllias("first"), NumericState(SpecialState.NoState)]
public class StateKeepFirst : CommandHandler
{
public override async Task<Result> Execute(IAbstractHandlerContainer<Message> container, CancellationToken cancellation)
{
container.CreateNumericState();
container.ForwardNumericState();
await Reply("first state moved (1)", cancellationToken: cancellation);
return Result.Ok();
}
}
// Registration:
bot.Handlers.AddHandler<StateKeepFirst>();
🏆 Why Telegrator over state machines?
- No tangled switch/case—logic is split into independent handlers.
- Flexible dispatching—the mediator decides who and when processes an event.
- Simple state management—no need to implement state machines manually.
- Easy scaling—add new handlers without rewriting old ones.
- High code readability and maintainability.
📚 Documentation & Examples
🤝 Contribution & Feedback
We welcome your questions, suggestions, and pull requests! Open issues or contact us directly.
⚡ License
GPLv3
Product | Versions 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. |
-
.NETStandard 2.0
- Telegram.Bot (>= 22.6.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Telegrator:
Package | Downloads |
---|---|
Telegrator.Hosting
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
1.15.9 | 219 | 8/24/2025 | |
1.15.8 | 210 | 8/24/2025 | |
1.15.7 | 72 | 8/23/2025 | |
1.15.6 | 139 | 8/21/2025 | |
1.15.5 | 145 | 8/19/2025 | |
1.15.4 | 135 | 8/19/2025 | |
1.15.3 | 137 | 8/19/2025 | |
1.15.2 | 188 | 8/18/2025 | |
1.15.1 | 134 | 8/18/2025 | |
1.15.0 | 136 | 8/18/2025 | |
1.0.13 | 144 | 8/11/2025 | |
1.0.12 | 189 | 8/8/2025 | |
1.0.11 | 138 | 8/4/2025 | |
1.0.10 | 75 | 8/2/2025 | |
1.0.9 | 47 | 8/1/2025 | |
1.0.8.1 | 84 | 8/1/2025 | |
1.0.8 | 88 | 8/1/2025 | |
1.0.7 | 103 | 7/28/2025 | |
1.0.6 | 112 | 7/28/2025 | |
1.0.5 | 112 | 7/27/2025 | |
1.0.4 | 122 | 7/27/2025 | |
1.0.3 | 159 | 7/27/2025 | |
1.0.2 | 262 | 7/26/2025 | |
1.0.1 | 406 | 7/25/2025 | |
1.0.0 | 542 | 7/24/2025 |