PyroHelpo Documentation
A powerful and flexible pagination library for Pyrogram bots that automatically handles help commands and module organization.
Python 3.7+
Pyrogram 2.0+
MIT 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
- 🌐 Group chat support with private message options
- 🎭 Flexible parse mode selection
- 🖼️ Media support with photo and video options
Installation
pip install pyrohelpo
Usage
Basic Setup
from pyrogram import Client
from Helpo import Helpo
from pyrogram.enums import ParseMode
# Initialize your Pyrogram client
app = Client("my_bot")
# Initialize Helpo
helpo = Helpo(
client=app,
modules_path="plugins",
buttons_per_page=6
)
Advanced Configuration
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",
"short_help": True,
"support_as_callback": True,
"support_c_back_name": "say_hi"
}
helpo = Helpo(
client=app,
modules_path="plugins",
buttons_per_page=6,
texts=custom_texts,
help_var="HELP",
module_var="MODULE",
photo="path/to/photo.jpg", # Optional: Add photo to help messages
video="path/to/video.mp4", # Optional: Add video to help messages
parse_mode=ParseMode.HTML, # Optional: Change parse mode (default: MARKDOWN)
disable_web_page_preview=False, # Optional: Enable web preview (default: True)
short_help=True # Optional: Enable short help mode
)
Module Setup
MODULE = "Admin" # Module name displayed in help menu
HELP = """
**Admin Commands**
/ban - Ban a user
/unban - Unban a user
/mute - Mute a user
/unmute - Unmute a user
"""
Customization Options
PyroHelpo 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 labelshelp_var
andmodule_var
: Set custom variable names for help text and module namesphoto
andvideo
: Add rich media to your help messagesparse_mode
: Set the parse mode for help messages (default: ParseMode.MARKDOWN)disable_web_page_preview
: Enable or disable web page previews in help messagesshort_help
: Enable or disable short help mode for concise module descriptions
Methods and Attributes
Helpo Class
Attributes:
client
: Pyrogram Client instancemodules_path
: Path to modules directorybuttons_per_page
: Number of buttons per pagehelp_var
: Variable name for help text (default: "**HELP**")module_var
: Variable name for module name (default: "**MODULE**")photo
: Optional photo URL/pathvideo
: Optional video URL/pathparse_mode
: Message parse modedisable_web_page_preview
: Web preview settingtexts
: Customizable text dictionaryshort_help
: Boolean to enable short help mode
Methods:
load_modules()
: Loads all modules from the specified pathshow_help_menu(chat_id: int, page: int = 1, message_id: int = None)
: Displays the main help menushow_module_help(query_or_message, module_name: str)
: Shows help for a specific modulesend_message(chat_id: int, text: str, reply_markup: InlineKeyboardMarkup = None, message_id: int = None)
: Sends a message with optional media and keyboardmonkeypatch_client()
: Patches the Pyrogram client to handle the `/help` command
Error Handling
PyroHelpo includes comprehensive error handling for:
- Invalid module files
- Missing required attributes
- Media loading failures
- Message sending errors
- Callback query processing
Gallery
Contributors
Support
Need help? Join our support chat or create an issue on our GitHub repository.