yawaflua.Telegram.Net
1.0.0
See the version list below for details.
dotnet add package yawaflua.Telegram.Net --version 1.0.0
NuGet\Install-Package yawaflua.Telegram.Net -Version 1.0.0
<PackageReference Include="yawaflua.Telegram.Net" Version="1.0.0" />
<PackageVersion Include="yawaflua.Telegram.Net" Version="1.0.0" />
<PackageReference Include="yawaflua.Telegram.Net" />
paket add yawaflua.Telegram.Net --version 1.0.0
#r "nuget: yawaflua.Telegram.Net, 1.0.0"
#:package yawaflua.Telegram.Net@1.0.0
#addin nuget:?package=yawaflua.Telegram.Net&version=1.0.0
#tool nuget:?package=yawaflua.Telegram.Net&version=1.0.0
Telegram Bot Attribute Handlers
This project provides a set of C# attributes to facilitate the handling of different types of Telegram bot updates using reflection.
Features
- Inline Query Handling (
InlineAttribute
) - Edited Message Handling (
EditMessageAttribute
) - Command Handling (
CommandHandlerAttribute
) - Callback Query Handling (
CallbackAttribute
) - PreCheckout Query Handling (
PreCheckoutAttribute
) - General Update Handling (
UpdateAttribute
) - Auto-generate telegram client
Installation
Ensure you have the required dependencies installed:
dotnet add package Telegram.Bot
Usage
Inline Query Handling
Use the InlineAttribute
to register a method as an inline query handler.
[Inline("example_query")]
public static async Task HandleInlineQuery(ITelegramBotClient bot, InlineQuery query, CancellationToken cancellationToken)
{
// Handle inline query
}
Edited Message Handling
Use the EditMessageAttribute
to register a method as a handler for edited messages.
[EditMessage]
public static async Task HandleEditedMessage(ITelegramBotClient bot, Message message, CancellationToken cancellationToken)
{
// Handle edited message
}
Command Handling
Use the CommandHandlerAttribute
to register a method as a command handler.
You can provide only begin of command text. Like, /start act-
[CommandHandler("/start")]
public static async Task StartCommand(ITelegramBotClient bot, Message message, CancellationToken cancellationToken)
{
// Handle start command
}
Callback Query Handling
Use the CallbackAttribute
to register a method as a callback query handler.
You can provide only begin of callback data text
[Callback("button_click")]
public static async Task HandleCallbackQuery(ITelegramBotClient bot, CallbackQuery query, CancellationToken cancellationToken)
{
// Handle callback query
}
PreCheckout Query Handling
Use the PreCheckoutAttribute
to register a method as a pre-checkout query handler.
[PreCheckout]
public static async Task HandlePreCheckoutQuery(ITelegramBotClient bot, PreCheckoutQuery query, CancellationToken cancellationToken)
{
// Handle pre-checkout query
}
General Update Handling
Use the UpdateAttribute
to register a method as a generic update handler.
[Update]
public static async Task HandleUpdate(ITelegramBotClient bot, Update update, CancellationToken cancellationToken)
{
// Handle general update
}
License
This project is open-source and available under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.3)
- Telegram.Bot (>= 22.4.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.