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.
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
json
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
Create Python files in your modules directory with the following structure:
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
"""
Custom Class Implementation
from pyrogram import Client
from Helpo import Helpo
class Bot(Client):
def __init__(self):
super().__init__(
"my_bot",
api_id=API_ID,
api_hash=API_HASH,
bot_token=BOT_TOKEN
)
self.helpo = Helpo(
client=self,
modules_path="plugins",
buttons_per_page=6,
texts=custom_texts
)
async def start(self):
await super().start()
print("Bot Started")
print(f"Loaded Modules: {', '.join(self.helpo.modules.keys())}")
async def stop(self):
await super().stop()
print("Bot Stopped")
Group Chat Support
Helpo automatically handles group chats by providing options to:
- View help menu in private chat
- View help menu directly in the group
- Customize group chat behavior through the texts dictionary
Deep Linking Support
@app.on_message(filters.command("start"))
async def start_command(client, message):
if len(message.text.split()) > 1:
param = message.text.split(None, 1)[1]
if param == "help":
await client.show_help_menu(message.chat.id)
else:
await message.reply("Welcome! Use /help to see available commands.")
Monkeypatch Client
To automatically handle the /help command in your bot, you can use the monkeypatch_client method:
from pyrogram import Client
from Helpo import Helpo
app = Client("my_bot")
helpo = Helpo(
client=app,
modules_path="plugins",
buttons_per_page=6,
texts=custom_texts
)
helpo.monkeypatch_client()
app.run()
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/helpcommand
Error Handling
Helpo includes comprehensive error handling for:
- Invalid module files
- Missing required attributes
- Media loading failures
- Message sending errors
- Callback query processing
Contributors 👥
License 📄
This project is licensed under the MIT License - see the LICENSE file for details.
Support 🤝
Need help? Join our support chat or create an issue on our GitHub repository.
Image Gallery 🖼️
Made with ❤️ by the Helpo team
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyrohelpo-4.1.5.tar.gz.
File metadata
- Download URL: pyrohelpo-4.1.5.tar.gz
- Upload date:
- Size: 10.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09ef4ae0be6e12c7a8682877c8568e6d539dcb784613673c8629f2978654ab3c
|
|
| MD5 |
6e9a4cb5ebdd0003710425e78361f813
|
|
| BLAKE2b-256 |
8a5abd9791ba572333f77fb7ee42050d55857dbc30c0f6c6b79fd971f2eed63d
|
Provenance
The following attestation bundles were made for pyrohelpo-4.1.5.tar.gz:
Publisher:
publish.yml on Vishal-1756/pyrohelpo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrohelpo-4.1.5.tar.gz -
Subject digest:
09ef4ae0be6e12c7a8682877c8568e6d539dcb784613673c8629f2978654ab3c - Sigstore transparency entry: 158238808
- Sigstore integration time:
-
Permalink:
Vishal-1756/pyrohelpo@26a6709a91ee26b5e50916e201465734b1ce75ea -
Branch / Tag:
refs/tags/4.1.5 - Owner: https://github.com/Vishal-1756
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26a6709a91ee26b5e50916e201465734b1ce75ea -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyrohelpo-4.1.5-py3-none-any.whl.
File metadata
- Download URL: pyrohelpo-4.1.5-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73cbe7ca4125860661ff9b2fe2e3fee0536a214a9e1735b658068c24aef241ec
|
|
| MD5 |
a89f79da2c23cb05fe1b2ad454d611cd
|
|
| BLAKE2b-256 |
5c59cbc10e32a460a26eff3721db7ba63ab2f756c19f97364fff2dd0bab3b85e
|
Provenance
The following attestation bundles were made for pyrohelpo-4.1.5-py3-none-any.whl:
Publisher:
publish.yml on Vishal-1756/pyrohelpo
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyrohelpo-4.1.5-py3-none-any.whl -
Subject digest:
73cbe7ca4125860661ff9b2fe2e3fee0536a214a9e1735b658068c24aef241ec - Sigstore transparency entry: 158238812
- Sigstore integration time:
-
Permalink:
Vishal-1756/pyrohelpo@26a6709a91ee26b5e50916e201465734b1ce75ea -
Branch / Tag:
refs/tags/4.1.5 - Owner: https://github.com/Vishal-1756
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@26a6709a91ee26b5e50916e201465734b1ce75ea -
Trigger Event:
release
-
Statement type: