Telegramper 2.2.3

dotnet add package Telegramper --version 2.2.3                
NuGet\Install-Package Telegramper -Version 2.2.3                
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="Telegramper" Version="2.2.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Telegramper --version 2.2.3                
#r "nuget: Telegramper, 2.2.3"                
#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.
// Install Telegramper as a Cake Addin
#addin nuget:?package=Telegramper&version=2.2.3

// Install Telegramper as a Cake Tool
#tool nuget:?package=Telegramper&version=2.2.3                

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

  1. About UpdateContext (similar to HttpContext)
  2. Configuration bot in Program.cs (Services, Middlewares, etc.)
  3. Executors and attributes
  4. 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 Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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)