Telegram.Bots.Extensions.Polling
2.1.0
See the version list below for details.
dotnet add package Telegram.Bots.Extensions.Polling --version 2.1.0
NuGet\Install-Package Telegram.Bots.Extensions.Polling -Version 2.1.0
<PackageReference Include="Telegram.Bots.Extensions.Polling" Version="2.1.0" />
paket add Telegram.Bots.Extensions.Polling --version 2.1.0
#r "nuget: Telegram.Bots.Extensions.Polling, 2.1.0"
// Install Telegram.Bots.Extensions.Polling as a Cake Addin #addin nuget:?package=Telegram.Bots.Extensions.Polling&version=2.1.0 // Install Telegram.Bots.Extensions.Polling as a Cake Tool #tool nuget:?package=Telegram.Bots.Extensions.Polling&version=2.1.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 | Versions 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. |
-
net5.0
- Microsoft.Extensions.Hosting (>= 5.0.0)
- Telegram.Bots (>= 2.1.0)
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,029 | 11/5/2022 |
5.8.0 | 1,473 | 11/3/2022 |
5.7.0 | 1,166 | 11/2/2022 |
5.6.0 | 1,483 | 6/12/2022 |
5.5.0 | 1,129 | 6/8/2022 |
5.4.0 | 1,011 | 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,601 | 6/27/2021 |
4.0.0 | 1,621 | 6/26/2021 |
2.1.0 | 1,259 | 3/21/2021 |
2.0.0 | 1,378 | 1/23/2021 |
1.1.1 | 1,833 | 11/6/2020 |