Telegramper 2.2.1
See the version list below for details.
dotnet add package Telegramper --version 2.2.1
NuGet\Install-Package Telegramper -Version 2.2.1
<PackageReference Include="Telegramper" Version="2.2.1" />
paket add Telegramper --version 2.2.1
#r "nuget: Telegramper, 2.2.1"
// Install Telegramper as a Cake Addin #addin nuget:?package=Telegramper&version=2.2.1 // Install Telegramper as a Cake Tool #tool nuget:?package=Telegramper&version=2.2.1
Telegramper
It is framework similar to a ASP.Net Core. Framework contains services, middlewares, configuration, controllers(executors) and other.
The framework is under development, so unexpected errors, changes in functionality, and names are possible! I would be grateful if you could report any bugs or functionality you need.
Installation
To install the framework, you can use NuGet.org https://www.nuget.org/packages/Telegramper.
Learn more about the framework
- About UpdateContext (similar to HttpContext)
- Configuration bot in Program.cs (Services, Middlewares, etc.)
- Executors and attributes
- Session
Chapters coming soon
- Dialog (comleted, documentation in process)
- Examples of projects written on the Telegramper framework
Donates
If you want to support to me, you can do it send me a crypto: BNB Smart Chain 0x0aB4b9A02bcaF822c3AeA91bc566aEA4194e1cEF
Quick start
internal class Program
{
static void Main(string[] args)
{
var builder = new BotApplicationBuilder();
builder.ConfigureApiKey("your api key");
builder.ReceiverOptions.ConfigureAllowedUpdates(UpdateType.Message, UpdateType.CallbackQuery); // default is UpdateType.Message
builder.Services.AddExecutors(); // identical to the controller in ASP.Net Core
var app = builder.Build();
app.UseExecutors();
app.RunPolling(); // webhooks are not implemented, but in the future you will be able to, for example, change polling to webhooks and vice versa
}
}
public class BasicExecutor : Executor
{
[TargetCommand] // identical to [TargetCommand("start")]
public async Task Start()
{
var sender = UpdateContext.User.ToString();
await Client.SendTextMessageAsync($"You are {sender}"); // send a text response
}
[TargetCommand("echo, command2")]
[EmptyParameterSeparator] // remove separator, by default is space(" ")
public async Task Echo(string phrase) // more about the parameters later
{
await Client.SendTextMessageAsync(phrase);
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- Microsoft.Extensions.Configuration (>= 7.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 7.0.0)
- Microsoft.Extensions.Configuration.Json (>= 7.0.0)
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- Microsoft.Extensions.Logging.Console (>= 7.0.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 7.0.0)
- Telegram.Bot (>= 19.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Alpha (may have bugs, do not use it in commercial projects)