Skip to main content

A powerful pagination library for Pyrogram bots

Project description

Helpo 📚

A powerful and flexible pagination library for Pyrogram bots that automatically handles help commands and module organization.

Python Pyrogram License

Features ✨

  • 🔄 Automatic module discovery and help text organization
  • 📱 Beautiful paginated help menus with inline buttons
  • 🎯 Support for both command-based and button-based help
  • 🎨 Customizable button layouts and texts
  • 🔌 Easy integration with existing Pyrogram bots
  • 📝 Support for rich media in help messages (photos, videos)
  • 🔗 Deep linking support for direct access to help menus

Installation 🚀

pip install pyrohelpo

Usage ⚙️

Initialize the Helpo instance

from Helpo import Helpo

custom_texts = {
    "help_menu_title": "**🛠 Custom Help Menu**",
    "help_menu_intro": "Available modules ({count}):\n{modules}\n\nTap on a module to explore.",
    "module_help_title": "**🔍 Details for {module_name} Module**",
    "module_help_intro": "Description:\n{help_text}",
    "no_modules_loaded": "⚠️ No modules available at the moment.",
    "back_button": "◀️ Go Back",
    "prev_button": "⬅️ Previous Page",
    "next_button": "➡️ Next Page",
    "support_button": "💬 Contact Support",
    "support_url": "https://t.me/YourSupportBot",
}

pagination = Helpo(
    client=bot,
    modules_path="fwd/plugins",
    buttons_per_page=9,
    texts=custom_texts,
    help_var="HELP",
    module_var="MODULE",
)

Set up help and module for each Python file in the modules path

MODULE = "HELPO"

HELP = "GO GOA GONE"  # You can use docstrings too

Using a custom class

from pyrogram import Client
from Helpo import Helpo

class Bot(Client):
    def __init__(self):
        super().__init__(
            "Hoshi-new",
            api_id=API_ID,
            api_hash=API_HASH,
            bot_token=TOKEN,
            plugins=dict(root="shivu"),
        )
        self.helpo = Helpo(
            client=self,
            modules_path="shivu/modules",
            buttons_per_page=6,
            texts=custom_texts,
        )

    async def start(self):
        await super().start()
        print("Pyro Bot Started")
        print(f"Helpo Initialized with Modules: {', '.join(self.helpo.modules.keys())}")

    async def stop(self):
        await super().stop()
        print("Pyro Bot Stopped")

Deep linking support

@bot.on_message(filters.command("start"))
async def start_command(client, message):
    if len(message.text.split()) > 1:
        name = message.text.split(None, 1)[1]
        if name.startswith("help"):
            await bot.show_help_menu(message.chat.id, page=1)

Adding a help button anywhere without callback query

from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from . import pagination  # Import your Helpo instance

@bot.on_message(filters.command("start"))
async def start_command(client, message):
    keyboard = InlineKeyboardMarkup([
        [InlineKeyboardButton("Help", callback_data="global_help")]
    ])
    await message.reply("Welcome! Click the button below for help.", reply_markup=keyboard)

Customization Options 🎨

Helpo offers various customization options to tailor the help menu to your bot's needs:

  • buttons_per_page: Set the number of buttons displayed per page (default: 6)
  • texts: Customize all text messages and button labels
  • help_var and module_var: Set custom variable names for help text and module names
  • photo and video: Add rich media to your help messages
  • parse_mode: Set the parse mode for help messages (default: ParseMode.MARKDOWN)
  • disable_web_page_preview: Enable or disable web page previews in help messages

Image Gallery

Help menu using video

Help menu using video Description: This menu displays video tutorials to help users.

Help menu using only text

Help menu using only text Description: This menu uses text-based instructions for simplicity.

Help menu using photo

Help menu using photo Description: This menu uses images to visually assist users.

Help menu of a module

Help menu of a module Description: This menu shows a module-specific help interface.

Methods and Attributes 📚

Helpo Class

Attributes:

  • client: The Pyrogram Client instance
  • modules_path: Path to the modules directory
  • buttons_per_page: Number of buttons per page in the help menu
  • help_var: Variable name for help text in modules
  • module_var: Variable name for module name in modules
  • photo: Optional photo to be used in help messages
  • video: Optional video to be used in help messages
  • parse_mode: Parse mode for help messages
  • disable_web_page_preview: Whether to disable web page previews in help messages
  • texts: Dictionary of customizable text strings

Error Handling

Helpo includes error handling for various scenarios:

  • Invalid module files
  • Missing required attributes in modules
  • Failed module loading
  • Message sending failures

Contributors 👥

License 📄

This project is licensed under the MIT License - see the LICENSE file for details.

Support 🤝

If you encounter any issues or have questions, please open an issue on the GitHub repository or join our support chat.

Acknowledgements 🙏

  • Pyrogram - The awesome MTProto library for Python
  • All contributors who have helped this project grow

Made with ❤️ by the Helpo team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrohelpo-2.3.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrohelpo-2.3.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file pyrohelpo-2.3.3.tar.gz.

File metadata

  • Download URL: pyrohelpo-2.3.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyrohelpo-2.3.3.tar.gz
Algorithm Hash digest
SHA256 69914b3bb84376534ee83db8fe751c65909ddde38d371673ef513bbff7bcf859
MD5 e604cac318c962497fd8f4ce7ed056d3
BLAKE2b-256 7b828c8fa136434a525e2b07cd0fa23ac38ed24dc77dba64ab5651fe29a48d01

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrohelpo-2.3.3.tar.gz:

Publisher: publish.yml on Vishal-1756/pyrohelpo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyrohelpo-2.3.3-py3-none-any.whl.

File metadata

  • Download URL: pyrohelpo-2.3.3-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pyrohelpo-2.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 64348286a7aa009e5ea494cb169f025ca454d7cbbe87e6a4512f1e4473d2b35f
MD5 a07087ad9a94d7718edf40c21c39a65d
BLAKE2b-256 7ba17d78b33dbd3d7e6e7bff066cb38a1eaf490ac4939300127b6eb6dd1dbc7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyrohelpo-2.3.3-py3-none-any.whl:

Publisher: publish.yml on Vishal-1756/pyrohelpo

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page