SKitLs.Bots.Telegram.PageNavs
2.0.0
Prefix Reserved
dotnet add package SKitLs.Bots.Telegram.PageNavs --version 2.0.0
NuGet\Install-Package SKitLs.Bots.Telegram.PageNavs -Version 2.0.0
<PackageReference Include="SKitLs.Bots.Telegram.PageNavs" Version="2.0.0" />
paket add SKitLs.Bots.Telegram.PageNavs --version 2.0.0
#r "nuget: SKitLs.Bots.Telegram.PageNavs, 2.0.0"
// Install SKitLs.Bots.Telegram.PageNavs as a Cake Addin #addin nuget:?package=SKitLs.Bots.Telegram.PageNavs&version=2.0.0 // Install SKitLs.Bots.Telegram.PageNavs as a Cake Tool #tool nuget:?package=SKitLs.Bots.Telegram.PageNavs&version=2.0.0
SKitLs.Bots.Telegram.PageNavs
README version: 2023
An extension project built upon the SKitLs.Bots.Telegram.Core Framework.
Allows to create special navigational menus.
Description
SKitLs.Bots.Telegram.PageNavs library offers a set of tools to create custom menus with inline keyboards and callbacks.
interface IMenuManager
(default:class DefaultMenuManager
):The IMenuManager interface serves as a manager and a service for inline message navigation via callbacks and
IBotPage
pages. It collects, stores, and provides access to preset menu pages. This interface is an add-on at the architecture level and can be accessed viaBotManager.ResolveService<T>
.interface IBotPage
(defaults:class WidgetPage
,class StaticPage
):Used for creating special messages that can act as menu pages.
interface IPageNavMenu
(default:class PageNavMenu
):Provides methods for creating page menus with integrated navigation functionality. Streamlines the process of creating navigation menus for different pages within the bot.
Setup
Ensure getting localization packs (*.pn.*).
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.PageNavs
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
Define pages:
// private IOutputMessage MainFormatter(ISignedUpdate? update) { //... } var mainBody = new DynamicMessage(MainFormatter); var mainMenu = new PageNavMenu(); var mainPage = new WidgetPage("mainId", "Main", mainBody, mainMenu); // private IOutputMessage TodayFormatter(ISignedUpdate? update) { //... } var todayScheduleBody = new DynamicMessage(TodayFormatter); var todayScheduleMenu = new PageNavMenu(); var todaySchedulePage = new WidgetPage("todayId", "Schedule (Today)", todayScheduleBody, todayScheduleMenu); // private IOutputMessage TomorrowFormatter(ISignedUpdate? update) { //... } var tomorrowScheduleBody = new DynamicMessage(TomorrowFormatter); var tomorrowSchedulePage = new WidgetPage("tomorrowId", "Schedule (Tomorrow)", tomorrowScheduleBody); // weekSchedulePage, upcomingSchedulePage
Set up and link menus:
todayScheduleMenu.PathTo(tomorrowSchedulePage, weekSchedulePage, upcomingSchedulePage); // private IBotAction<SignedCallbackUpdate> DoDomeAction // ... mainMenu.PathTo(todaySchedulePage); mainMenu.AddAction(DoDomeAction);
Defines Menu Manager:
var _mm = new DefaultMenuManager(); _mm.Define(mainPage); _mm.Define(todaySchedulePage); _mm.Define(tomorrowSchedulePage); _mm.Define(weekSchedulePage); _mm.Define(upcomingSchedulePage);
Do not forget to apply your manager to your Stateful Callback Manager:
_mm.ApplyTo(statefulCallbacks);
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) 2023-2024, SKitLs
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 or email: skitlsdev@gmail.com
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 | net8.0 is compatible. 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. |
-
net8.0
- SKitLs.Bots.Telegram.AdvancedMessages (>= 3.0.3)
- SKitLs.Bots.Telegram.ArgedInteractions (>= 1.5.3)
- SKitLs.Bots.Telegram.Core (>= 3.1.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SKitLs.Bots.Telegram.PageNavs:
Package | Downloads |
---|---|
SKitLs.Bots.Telegram.DataBases
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
2.0.0 | 229 | 3/26/2024 | |
1.6.1 | 224 | 3/21/2024 | |
1.6.1-alpha1 | 186 | 9/20/2023 | |
1.6.1-alpha0 | 195 | 9/9/2023 | |
1.6.0 | 283 | 9/9/2023 | |
1.5.0 | 280 | 8/12/2023 | |
1.4.0 | 294 | 8/2/2023 | |
1.3.1 | 302 | 7/25/2023 |
(!) Menu Manager Rework
MenuManager was splitted into: MenuService + SessionsManager
~ Updated: IMenuManager -> IMenuService : IBotService
~ Updated: MenuManager -> MenuService : BotServiceBase
+ Added: ISessionsManager / SessionsManager (handles sessions management data)
~ Updated: HandleSessionExpiredAsync moved to static class MenusHelper
+ Added: abstract class PageBase
+ Added: class StaticPage : PageBase (to display static content)
+ Added: abstract class WidgetPageBase : PageBase
~ Rework: class WidgetPage : WidgetPageBase
+ Added: class LocalizedPage : WidgetPageBase (to display localized text; no implemented formatting)
+ Added: class DynamicLocalPage : LocalizedPage (to display localized text; implemented formatting funcs)
(!) Pages Rework
- Removed: IBotPage.Menu
~ Changed: IBotPage string GetLabel() -> Task<string> BuildLabelAsync()
~ Changed: IBotPage.BuildMessageAsync() Task<IOutputMessage> -> Task<ITelegramMessage>
(+) Added: delegates DynamicPageStringTask, DynamicPageStringsTask, DynamicPageMessageTask
(+) Added: DefaultBackCallback
(+) Added: DefaultOpenPageCallback
(-) Removed Obsolete: MenuNavigatorArg
(-) Removed Obsolete: StaticPage
(~) Updated: namespaces
(~) Updated: .Core, .ArgedInteractions, .AdvancedMessages namespaces update
(~) Updated: XML-Documentation
(~) Updated: README
(+) Added: PageNavMenu.AutomaticallyLocalize
NOTE: PageMenus should be reworked in further updates