AKI.TelegramBot.Hosting
1.0.7
See the version list below for details.
dotnet add package AKI.TelegramBot.Hosting --version 1.0.7
NuGet\Install-Package AKI.TelegramBot.Hosting -Version 1.0.7
<PackageReference Include="AKI.TelegramBot.Hosting" Version="1.0.7" />
paket add AKI.TelegramBot.Hosting --version 1.0.7
#r "nuget: AKI.TelegramBot.Hosting, 1.0.7"
// Install AKI.TelegramBot.Hosting as a Cake Addin #addin nuget:?package=AKI.TelegramBot.Hosting&version=1.0.7 // Install AKI.TelegramBot.Hosting as a Cake Tool #tool nuget:?package=AKI.TelegramBot.Hosting&version=1.0.7
AKI.TelegramBot
This repository contains a Telegram Bot framework implemented in C# using the Telegram.Bot library. The framework provides a convenient and extensible solution for building modular Telegram Bots.
Project Goals
Modularity: Build Telegram Bots with modular components, allowing easy customization and extension.
Abstraction: Provide an abstraction layer for handling commands, callbacks, and middleware, simplifying bot development.
Integration: Seamlessly integrate with the Telegram Bot API for sending and receiving messages, handling updates, and more.
Scalability: Design the framework to support high-traffic bots and enable easy deployment to various hosting platforms.
Features
Command handling: Easily define and handle commands with customizable logic.
Callback handling: Handle callback queries from inline keyboards and other interactive elements.
Middleware support: Implement custom middleware for request processing and pipeline management.
Integration with Telegram Bot API: Interact with the Telegram Bot API for sending messages, managing chats, and more.
Usage Example
class Program
{
static void Main(string[] args)
{
var host = Host.CreateDefaultBuilder(args)
.ConfigureServices((hostContext, services) =>
{
services.AddTelegramBot(config =>
{
config.BotToken = "YOUR_BOT_TOKEN";
// Add other configuration options if needed
})
.AddMessageHandler<HelpCommandHandler>("/help")
.SetDefaultMessageHandler<DefaultMessageHandler>();
})
.Build();
host.Run();
}
}
In this example, we create a new Host
using Host.CreateDefaultBuilder
and configure the services using the ConfigureServices
method. Within the service configuration, we use the AddTelegramBot
method to register the Telegram Bot and provide the necessary configuration, such as the bot token. We then register our command handlers using the AddMessageHandler
method, specifying the command and the corresponding handler class. Finally, we set the default message handler using the SetDefaultMessageHandler
method.
Please note that you need to replace "YOUR_BOT_TOKEN"
with your actual bot token obtained from the BotFather on Telegram.
Getting Started
To install the package, you can use the following command in the Nuget Package Manager console:
Install-Package AKI.TelegramBot.Hosting
Contributing
Contributions are welcome! If you find a bug or have a feature request, please open an issue. Pull requests are also appreciated.
License
This project is licensed under the Apache License 2.0. See the LICENSE file for more details.
Acknowledgements
- Telegram.Bot library for Telegram Bot API integration
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. |
-
net6.0
- Microsoft.Extensions.Hosting (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
- Serilog (>= 3.1.1)
- System.Threading.Channels (>= 8.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.
Version | Downloads | Last updated |
---|---|---|
1.0.21 | 138 | 3/10/2024 |
1.0.20 | 120 | 3/7/2024 |
1.0.19 | 114 | 2/21/2024 |
1.0.18 | 125 | 2/1/2024 |
1.0.17 | 100 | 1/30/2024 |
1.0.16 | 136 | 1/16/2024 |
1.0.15 | 103 | 1/16/2024 |
1.0.14 | 98 | 1/16/2024 |
1.0.13 | 105 | 1/16/2024 |
1.0.12 | 111 | 1/16/2024 |
1.0.11 | 95 | 1/16/2024 |
1.0.10 | 104 | 1/16/2024 |
1.0.9 | 113 | 1/16/2024 |
1.0.8 | 111 | 1/16/2024 |
1.0.7 | 108 | 1/15/2024 |
1.0.6 | 108 | 1/15/2024 |
1.0.5 | 102 | 1/15/2024 |
1.0.4 | 96 | 1/15/2024 |
1.0.3 | 100 | 1/15/2024 |
1.0.2 | 104 | 1/15/2024 |
1.0.1 | 117 | 1/11/2024 |
1.0.0 | 111 | 1/10/2024 |