SKitLs.Bots.Telegram.BotProcesses
1.0.0-alpha.2
Prefix Reserved
See the version list below for details.
dotnet add package SKitLs.Bots.Telegram.BotProcesses --version 1.0.0-alpha.2
NuGet\Install-Package SKitLs.Bots.Telegram.BotProcesses -Version 1.0.0-alpha.2
<PackageReference Include="SKitLs.Bots.Telegram.BotProcesses" Version="1.0.0-alpha.2" />
paket add SKitLs.Bots.Telegram.BotProcesses --version 1.0.0-alpha.2
#r "nuget: SKitLs.Bots.Telegram.BotProcesses, 1.0.0-alpha.2"
// Install SKitLs.Bots.Telegram.BotProcesses as a Cake Addin #addin nuget:?package=SKitLs.Bots.Telegram.BotProcesses&version=1.0.0-alpha.2&prerelease // Install SKitLs.Bots.Telegram.BotProcesses as a Cake Tool #tool nuget:?package=SKitLs.Bots.Telegram.BotProcesses&version=1.0.0-alpha.2&prerelease
SKitLs.Bots.Telegram.BotProcesses
An extension project built upon the SKitLs.Bots.Telegram.Core Framework.
Provides methods of creating bot processes with advanced textual input mechanics.
Description
SKitLs.Bots.Telegram.BotProcesses is a powerful library designed to facilitate the implementation of a model that assigns personalized buffers to individual users, each containing their current active tasks. This library is targeted for use in Telegram bot development, enabling seamless integration with bot processes.
interface IBotProcess
andinterface IBotRunningProcess
:The
IBotProcess
interface defines the contract for a bot process. Each process is assigned a unique identifier, and it maintains its state, which represents the user-specific state information associated with the process. TheIBotProcess
used for creation a descriptive model of a process, meanwhileIBotRunningProcess
represents launched for a certain user process.The
IBotRunningProcess
interface extends the functionalities of theIBotProcess
interface, providing additional methods to manage running bot processes. It includes methods to launch a process with updates and handle input during the process execution.interface IProcessManager
(default:class DefaultProcessManager
):The IProcessManager interface provides functionalities for managing bot processes. It allows defining individual processes or collections of processes. The manager can initiate a bot process based on specific arguments and user updates. Additionally, it provides methods to retrieve running processes and terminate them.
Default Processes (via
TextInputsProcessBase<TArg>
):The
TextInputsProcessBase<TArg>
abstract class serves as the foundation for input processes. Derived from this class, default input processes can be created with custom process argumentsTArg
, which must implement theIProcessArgument
interface.One of its key features lies in the provision of essential base solutions inherited from the
TextInputsProcessBase<TArg>
class, which significantly simplifies the implementation of various bot functionalities.- ComplexShotInputProcess
- ShotInputProcess
- IntInputProcess
- PartialInputProcess
By leveraging the base solutions provided by SKitLs.Bots.Telegram.BotProcesses, you can focus on implementing bot-specific functionalities, reducing development time, and ensuring a robust and interactive Telegram bot experience.
With SKitLs.Bots.Telegram.BotProcesses, you can build interactive Telegram bots and manage personalized tasks efficiently, making it an essential addition to your Telegram bot development toolkit.
Setup
Requirements
- Telegram.Bot 19.0.0 or higher
- SKitLs.Bots.Telegram.Core 2.0.0 or higher
- SKitLs.Bots.Telegram.Stateful 1.1.0 or higher
- SKitLs.Bots.Telegram.AdvancedMessages 1.1.0 or higher
- SKitLs.Bots.Telegram.ArgedInteractions 1.3.1 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.BotProcesses
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.
Do not forget to download and install appropriate localization pack from GitHub.
Usage
Use process manager:
var _pm = new DefaultProcessManager(); BotBuilder.NewBuilder("token") .AddService<IProcessManager>(_pm) .Build() .Listen();
Initialize processes:
private static async Task When_ProcessCompletedAsync(TextInputsArguments<YourType> args, SignedMessageTextUpdate update) { if (args.CompleteStatus == CompleteStatus.Success) { await this.SendToDatabaseExample<YourType>(args.BuildingInstance); } // Some inform action await InformSenderAsync(args.CompleteStatus, update); }
var procState = DefaultUserStatenew(1001, "procId.state"); var message = new OutputMessageText("Please, fill all details:"); ShotInputProcess<YourType> process = new("procId", "Cancel", procState, message, When_ProcessCompletedAsync);
Define them:
// Resolve if necessary // var _pm = _botManager.ResolveService<IProcessManager>(); _pm.Define(process);
Access and run defined process anytime:
priate async Task UpdateHandledAsync(SignedMessageTextUpdate update) { var _pm = update.Owner.ResolveService<IProcessManager>(); await _pm.GetDefined("procId") .GetRunning(update.Sender.TelegramId, new TextInputsArguments(new YourType())) .LauchWith(update); }
Enhancing experience:
Do not forget to define appropriate rules for converting. For this example:
// Building logic var serializer = _botManager.ResolveService<IArgsSerializeService>(); serializer.AddRule<YourType>(input => { YourType customDataInstance; // Custom logic to convert the string input into YourType // ... (implementation details) return ConvertResult<YourType>.Success(customDataInstance); });
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.Bots.Telegram.AdvancedMessages (>= 1.1.0)
- SKitLs.Bots.Telegram.ArgedInteractions (>= 1.3.1)
- SKitLs.Bots.Telegram.Core (>= 2.0.0)
- SKitLs.Bots.Telegram.Stateful (>= 1.1.0)
- Telegram.Bot (>= 19.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SKitLs.Bots.Telegram.BotProcesses:
Package | Downloads |
---|---|
SKitLs.Bots.Telegram.DataBases
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.0-rc2 | 136 | 9/9/2023 |
1.1.0-rc | 103 | 8/12/2023 |
1.0.0-rc | 117 | 8/6/2023 |
1.0.0-alpha.3 | 90 | 8/4/2023 |
1.0.0-alpha.2 | 86 | 8/3/2023 |
1.0.0-alpha.1 | 87 | 8/3/2023 |
1.0.0-alpha | 92 | 8/3/2023 |
(+) class TextInputsArguments Added.
(~) TextInputsProcessBase heirs now work with TextInputsArguments.