SKitLs.Bots.Telegram.Core
1.5.1
Prefix Reserved
See the version list below for details.
dotnet add package SKitLs.Bots.Telegram.Core --version 1.5.1
NuGet\Install-Package SKitLs.Bots.Telegram.Core -Version 1.5.1
<PackageReference Include="SKitLs.Bots.Telegram.Core" Version="1.5.1" />
paket add SKitLs.Bots.Telegram.Core --version 1.5.1
#r "nuget: SKitLs.Bots.Telegram.Core, 1.5.1"
// Install SKitLs.Bots.Telegram.Core as a Cake Addin #addin nuget:?package=SKitLs.Bots.Telegram.Core&version=1.5.1 // Install SKitLs.Bots.Telegram.Core as a Cake Tool #tool nuget:?package=SKitLs.Bots.Telegram.Core&version=1.5.1
SKitLs.Bots.Telegram.Core
The core module of the SKitLs.Bots.Telegram Framework.
Description
SKitLs.Bots.Telegram.Core is a central package of the SKitLs.Bots.Telegram framework, providing essential mechanics for interfacing with the Telegram API. Serving as a wrapper for the Telegram.Bot project, it acts as a core foundation for Telegram bot development.
At the heart of this package lies the BotManager
class, designed to streamline the interaction process with server updates
and unpack them into strictly typed ICastedUpdate
classes.
By leveraging the capabilities of BotManager, developers can automate the handling of updates received from the Telegram servers,
facilitating the efficient processing of incoming data.
Furthermore, BotManager incorporates a straightforward Inversion of Control (IoC) container, ensuring seamless management and configuration of dependencies within the framework.
SKitLs.Bots.Telegram.Core empowers developers with a reliable and robust foundation to build Telegram bots with ease. Its comprehensive features and well-structured design facilitate the development process, allowing developers to focus on implementing bot logic without the hassle of handling low-level API interactions.
Setup
Requirements
- Telegram.Bot 19.0.0 or higher
- SKitLs.Utils.LocalLoggers 1.2.7 or higher
Before running the project, please ensure that you have the following dependencies installed and properly configured in your development environment.
Installation
Using Terminal Command:
To install the project using the terminal command, follow these steps:
- Open the terminal or command prompt.
- Run command:
dotnet add package SKitLs.Bots.Telegram.Core
Using NuGet Packages Manager:
To install the project using the NuGet Packages Manager, perform the following steps:
- Open your preferred Integrated Development Environment (IDE) that supports NuGet package management (e.g., Visual Studio).
- Create a new project or open an existing one.
- Select "Project" > "Manage NuGet Packages"
- In the "Browse" tab, search for the project package you want to install.
- Click on the "Install" button to add the selected package to your project.
- Follow any additional setup instructions or configurations provided in the project's documentation.
Downloading Source Code and Direct Linking:
To install the project by downloading the source code and directly linking it to your project, adhere to the following steps:
- Visit the project repository on GitHub
- Click on the "Code" button and select "Download ZIP" to download the project's source code as a zip archive.
- Extract the downloaded zip archive to the desired location on your local machine.
- Open your existing project or create a new one in your IDE.
- Add the downloaded project files to your solution using the "Add Existing Project" option in your IDE's solution explorer.
- Reference the project in your solution and ensure any required dependencies are resolved.
- Follow any additional setup or configuration instructions provided in the project's documentation.
Please note that each method may have specific requirements or configurations that need to be followed for successful installation. Refer to the project's documentation for any additional steps or considerations.
Usage
See GitHub page for more information.
Setup
Each project supports localized debugging. Some of them requires specific language packages. You can find them in GitHub's locals folder.
Place locals in "resources/locals" or update localization path.
BotBuilder.DebugSettings.DebugLanguage = LangKey.EN;
BotBuilder.DebugSettings.UpdateLocalsPath("path/to/data");
Examples
Quick Start
static async Task Main(string[] args) { var privateMessages = new DefaultSignedMessageUpdateHandler(); var privateTexts = new DefaultSignedMessageTextUpdateHandler { CommandsManager = new DefaultActionManager<SignedMessageTextUpdate>() }; privateTexts.CommandsManager.AddSafely(StartCommand); privateMessages.TextMessageUpdateHandler = privateTexts; ChatDesigner privates = ChatDesigner.NewDesigner() .UseMessageHandler(privateMessages); await BotBuilder.NewBuilder("YOUR_TOKEN") .EnablePrivates(privates) .Build() .Listen(); } private static DefaultCommand StartCommand => new("start", Do_StartAsync); private static async Task Do_StartAsync(SignedMessageTextUpdate update) { await update.Owner.DeliveryService.ReplyToSender("Hello, world!", update); }
Add More Actions
private static DefaultCommand StartCommand => new("start", Do_StartAsync); private static async Task Do_StartAsync(SignedMessageTextUpdate update) { await update.Owner.DeliveryService.ReplyToSender("Hello, world!", update); } private static DefaultCommand ExitInput => new("Exit bot!", Do_ExitAsync); private static DefaultCommand ExitCommand => new("exit", Do_ExitAsync); private static async Task Do_ExitAsync(SignedMessageTextUpdate update) { await update.Owner.DeliveryService.ReplyToSender("I'm Done!", update); } private static DefaultCallback HelloCallback => new("helloCB", Do_HelloAsync); private static async Task Do_HelloAsync(SignedCallbackUpdate update) { // Acces Telegram.Bot bot instance if necessary await update.Owner.Bot.EditMessageTextAsync(update.TriggerMessageId, "Updated Body!") }
You can use SKitLs.Bots.Telegram.AdvancedMessages package to get better messaging experience.
Use Services
Add service to bot
await BotBuilder.NewBuilder("YOUR_TOKEN") .EnablePrivates(privates) .AddServices<ISomeService>(new SomeService()) .Build() .Listen();
Resolve one when needed
private static DefaultCommand StartCommand => new("start", Do_StartAsync); private static async Task Do_StartAsync(SignedMessageTextUpdate update) { var someService = update.Owner.ResolveService<ISomeService>(); await update.Owner.DeliveryService.ReplyToSender(someService.GetContentFor(update.Text), update); }
Contributors
Currently, there are no contributors actively involved in this project. However, our team is eager to welcome contributions from anyone interested in advancing the project's development.
We value every contribution and look forward to collaborating with individuals who share our vision and passion for this endeavor. Your participation will be greatly appreciated in moving the project forward.
Thank you for considering contributing to our project.
License
This project is distributed under the terms of the MIT License.
Copyright (C) Sargeras02 2023
Developer contact
For any issues related to the project, please feel free to reach out to us through the project's GitHub page. We welcome bug reports, feedback, and any other inquiries that can help us improve the project.
You can also contact the project owner directly via their GitHub profile at the following link.
Your collaboration and support are highly appreciated, and we will do our best to address any concerns or questions promptly and professionally. Thank you for your interest in our project.
Notes
Thank you for choosing our solution for your needs, and we look forward to contributing to your project's success.
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
- SKitLs.Utils.LocalLoggers (>= 1.2.7.1)
- Telegram.Bot (>= 19.0.0)
NuGet packages (6)
Showing the top 5 NuGet packages that depend on SKitLs.Bots.Telegram.Core:
Package | Downloads |
---|---|
SKitLs.Bots.Telegram.AdvancedMessages
Offers enhanced methods for sending messages in Telegram bots. An extension project built upon the SKitLs.Bots.Telegram.Core Framework. |
|
SKitLs.Bots.Telegram.ArgedInteractions
Provides mechanism for the serialization and deserialization of textual data. An extension project built upon the SKitLs.Bots.Telegram.Core Framework. |
|
SKitLs.Bots.Telegram.PageNavs
Allows to create special navigational menus. An extension project built upon the SKitLs.Bots.Telegram.Core Framework. |
|
SKitLs.Bots.Telegram.Stateful
Enables the segregation of user states. An extension project built upon the SKitLs.Bots.Telegram.Core Framework. |
|
SKitLs.Bots.Telegram.BotProcesses
Provides methods of creating bot processes with advanced textual input mechanics. An extension project built upon the SKitLs.Bots.Telegram.Core Framework. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
3.1.2 | 279 | 3/26/2024 | |
3.1.2-alpha0 | 106 | 3/25/2024 | |
3.1.2-alpha.1 | 66 | 3/25/2024 | |
3.1.1 | 241 | 3/24/2024 | |
3.1.1-alpha0 | 104 | 3/23/2024 | |
3.1.0 | 175 | 3/23/2024 | |
3.0.1 | 157 | 3/23/2024 | |
3.0.0 | 165 | 3/22/2024 | |
2.4.0 | 239 | 3/21/2024 | |
2.3.2 | 237 | 10/10/2023 | |
2.3.1 | 388 | 8/22/2023 | |
2.3.0 | 327 | 8/19/2023 | |
2.2.0 | 248 | 8/13/2023 | |
2.1.3 | 368 | 8/12/2023 | |
2.1.2 | 300 | 8/11/2023 | |
2.1.0 | 222 | 8/8/2023 | |
2.0.1 | 199 | 8/5/2023 | |
2.0.1-alpha | 157 | 8/5/2023 | |
2.0.0 | 315 | 8/1/2023 | |
1.5.1 | 183 | 7/30/2023 | |
1.4.3 | 372 | 7/23/2023 | |
1.4.2 | 175 | 7/22/2023 |
[1.5.0] + [1.5.1]
( ! ) Loggers (*.external namespace) were moved to stand-alone library.
See: SKitLs.Utils.
(*) Debug Language bug fixed.
(+) README Added. README Updated.
(~) Descriptions and naming updated.