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                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SKitLs.Bots.Telegram.PageNavs" Version="2.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SKitLs.Bots.Telegram.PageNavs --version 2.0.0                
#r "nuget: SKitLs.Bots.Telegram.PageNavs, 2.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// 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 Static Badge GitHub Nuget CodeFactor

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.

  1. 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 via BotManager.ResolveService<T>.

  2. interface IBotPage (defaults: class WidgetPage, class StaticPage):

    Used for creating special messages that can act as menu pages.

  3. 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

  1. Using Terminal Command:

    To install the project using the terminal command, follow these steps:

    1. Open the terminal or command prompt.
    2. Run command:
    dotnet add package SKitLs.Bots.Telegram.PageNavs
    
  2. Using NuGet Packages Manager:

    To install the project using the NuGet Packages Manager, perform the following steps:

    1. Open your preferred Integrated Development Environment (IDE) that supports NuGet package management (e.g., Visual Studio).
    2. Create a new project or open an existing one.
    3. Select "Project" > "Manage NuGet Packages"
    4. In the "Browse" tab, search for the project package you want to install.
    5. Click on the "Install" button to add the selected package to your project.
    6. Follow any additional setup instructions or configurations provided in the project's documentation.
  3. 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:

    1. Visit the project repository on GitHub
    2. Click on the "Code" button and select "Download ZIP" to download the project's source code as a zip archive.
    3. Extract the downloaded zip archive to the desired location on your local machine.
    4. Open your existing project or create a new one in your IDE.
    5. Add the downloaded project files to your solution using the "Add Existing Project" option in your IDE's solution explorer.
    6. Reference the project in your solution and ensure any required dependencies are resolved.
    7. 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

  1. 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
    
  2. Set up and link menus:

    todayScheduleMenu.PathTo(tomorrowSchedulePage, weekSchedulePage, upcomingSchedulePage);
    
    // private IBotAction<SignedCallbackUpdate> DoDomeAction // ...
    mainMenu.PathTo(todaySchedulePage);
    mainMenu.AddAction(DoDomeAction);
    
  3. Defines Menu Manager:

    var _mm = new DefaultMenuManager();
    
    _mm.Define(mainPage);
    _mm.Define(todaySchedulePage);
    _mm.Define(tomorrowSchedulePage);
    _mm.Define(weekSchedulePage);
    _mm.Define(upcomingSchedulePage);
    
  4. 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 223 3/26/2024
1.6.1 220 3/21/2024
1.6.1-alpha1 185 9/20/2023
1.6.1-alpha0 195 9/9/2023
1.6.0 279 9/9/2023
1.5.0 277 8/12/2023
1.4.0 290 8/2/2023 1.4.0 is deprecated because it has critical bugs.
1.3.1 292 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