Telegrator 1.17.1
dotnet add package Telegrator --version 1.17.1
NuGet\Install-Package Telegrator -Version 1.17.1
<PackageReference Include="Telegrator" Version="1.17.1" />
<PackageVersion Include="Telegrator" Version="1.17.1" />
<PackageReference Include="Telegrator" />
paket add Telegrator --version 1.17.1
#r "nuget: Telegrator, 1.17.1"
#:package Telegrator@1.17.1
#addin nuget:?package=Telegrator&version=1.17.1
#tool nuget:?package=Telegrator&version=1.17.1
🚀 About Telegrator
Telegrator is a modern C# framework for building Telegram bots, 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.
Learn and Docs
Learn Telegrator on Official documentation site.
The documentation may not be completely transparent, informative or even actual to latest version, so if you have any questions or problems, please write them in the Telegram.Bot group. I am a member of this group and will notice you! If you have any suggestions or want to participate in building documentation, make push requests and open issues on this repository!
✨ 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(IHandlerContainer<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, CommandAlias("start", "hello"), ChatType(ChatType.Private)]
public class StartCommandHandler : CommandHandler
{
public override async Task<Result> Execute(IHandlerContainer<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, CommandAlias("first"), State<SetupWizard>(null)]
public class StateKeepFirst : CommandHandler
{
public override async Task<Result> Execute(IHandlerContainer<Message> container, CancellationToken cancellation)
{
StateStorage.GetStateMachine<SetupWizard>().BysenderId().Advance();
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
- Microsoft.Bcl.AsyncInterfaces (>= 10.0.7)
- System.Threading.Channels (>= 10.0.7)
- Telegram.Bot (>= 22.9.5.3)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Telegrator:
| Package | Downloads |
|---|---|
|
Telegrator.Hosting
Package Description |
|
|
Telegartor.RedisStateStorage
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.17.1 | 112 | 5/1/2026 |
| 1.17.0 | 117 | 4/27/2026 |
| 1.16.9 | 114 | 4/23/2026 |
| 1.16.8 | 131 | 4/3/2026 |
| 1.16.7 | 133 | 3/15/2026 |
| 1.16.6 | 168 | 3/15/2026 |
| 1.16.5 | 157 | 3/9/2026 |
| 1.16.4 | 144 | 3/9/2026 |
| 1.16.3 | 114 | 3/8/2026 |
| 1.16.1 | 114 | 3/7/2026 |
| 1.16.0 | 114 | 3/7/2026 |
| 1.15.9 | 631 | 8/24/2025 |
| 1.15.8 | 314 | 8/24/2025 |
| 1.15.7 | 166 | 8/23/2025 |
| 1.15.6 | 236 | 8/21/2025 |
| 1.15.5 | 241 | 8/19/2025 |
| 1.15.4 | 232 | 8/19/2025 |
| 1.15.3 | 228 | 8/19/2025 |
| 1.15.2 | 281 | 8/18/2025 |
| 1.15.1 | 222 | 8/18/2025 |