Telegram.Bots.Extensions.Polling 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Telegram.Bots.Extensions.Polling --version 2.0.0                
NuGet\Install-Package Telegram.Bots.Extensions.Polling -Version 2.0.0                
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="Telegram.Bots.Extensions.Polling" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Telegram.Bots.Extensions.Polling --version 2.0.0                
#r "nuget: Telegram.Bots.Extensions.Polling, 2.0.0"                
#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 Telegram.Bots.Extensions.Polling as a Cake Addin
#addin nuget:?package=Telegram.Bots.Extensions.Polling&version=2.0.0

// Install Telegram.Bots.Extensions.Polling as a Cake Tool
#tool nuget:?package=Telegram.Bots.Extensions.Polling&version=2.0.0                

Telegram.Bots.Extensions.Polling

Integrate Long Polling with Telegram.Bots

Getting Started

Configuring Long Polling with Telegram.Bots
using Microsoft.Extensions.DependencyInjection;
using Telegram.Bots;

...

IServiceCollection services = ...

services.AddBotClient("<bot-token>");
services.AddPolling<UpdateHandler>();
Configuring an Update Handler
using Telegram.Bots.Extensions.Polling;
using Telegram.Bots.Requests;
using Telegram.Bots.Types;

...

public class UpdateHandler : IUpdateHandler
{
  public Task HandleAsync(IBotClient bot, Update update, CancellationToken token)
  {
    return update switch
    {
      MessageUpdate u when u.Data is TextMessage message => EchoText(message),
      EditedMessageUpdate u when u.Data is TextMessage message => EchoTextAsReply(message),
      _ => Task.CompletedTask
    };

    Task EchoText(TextMessage message) =>
      bot.HandleAsync(new SendText(message.Chat.Id, message.Text), token);

    Task EchoTextAsReply(TextMessage message) =>
      bot.HandleAsync(new SendText(message.Chat.Id, message.Text)
      {
        ReplyToMessageId = message.Id
      }, token);
  }
}

License

Telegram.Bots.Extensions.Polling is an extension of Telegram.Bots.
Copyright © 2020-2021 Aman Agnihotri (amanagnihotri@pm.me)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with This program. If not, see GNU Licenses.


Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Telegram.Bots.Extensions.Polling:

Package Downloads
LiraSharpLib

Package Description

LiraSharp

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.9.0 40,154 11/5/2022
5.8.0 1,473 11/3/2022
5.7.0 1,168 11/2/2022
5.6.0 1,483 6/12/2022
5.5.0 1,133 6/8/2022
5.4.0 1,013 6/8/2022
5.3.0 1,043 6/8/2022
5.2.0 981 6/8/2022
5.1.0 1,426 9/2/2021
5.0.0 1,603 6/27/2021
4.0.0 1,623 6/26/2021
2.1.0 1,259 3/21/2021
2.0.0 1,378 1/23/2021
1.1.1 1,835 11/6/2020