| title | TeleFlow | ||
|---|---|---|---|
| hide |
|
Telegram bot framework for .NET
TeleFlow keeps the first command simple and the grown bot explicit: typed handlers, dependency injection, generated metadata, state, callbacks, long polling, webhooks, and direct Telegram Bot API access.
Program.cs
builder.Services.AddTelegramBot(options =>
{
options.Token = token;
});
builder.Services.AddLongPolling();
builder.Services.AddTelegramHandlersFromAssembly(
typeof(Program).Assembly);
public sealed class StartHandler
{
[Command("start")]
public Task Handle(
MessageContext ctx,
CancellationToken ct)
{
return ctx.Message.AnswerAsync(
"Hello from TeleFlow.");
}
}</div>
Framework principles
Convenient does not have to mean hidden
TeleFlow uses normal C# handlers and normal .NET dependency injection. The recommended path generates handler metadata at build time and fails clearly when generated registration is missing.