pyrohelpo


Namepyrohelpo JSON
Version 4.1.4 PyPI version JSON
download
home_pagehttps://github.com/vishal-1756/Helpo
SummaryA powerful pagination library for Pyrogram bots
upload_time2024-12-15 10:09:32
maintainerNone
docs_urlNone
authorVishal-1756
requires_python>=3.7
licenseNone
keywords pyrogram telegram bot pagination help-menu
VCS
bugtrack_url
requirements pyrogram TgCrypto
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Helpo 📚

![Image](https://socialify.git.ci/Vishal-1756/pyrohelpo/image?description=1&font=KoHo&name=1&owner=1&pattern=Charlie%20Brown&theme=Dark)

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

![Python](https://img.shields.io/badge/Python-3.7%2B-blue)
![Pyrogram](https://img.shields.io/badge/Pyrogram-2.0%2B-green)
![License](https://img.shields.io/badge/License-MIT-yellow)
![PyPI Downloads](https://static.pepy.tech/badge/pyrohelpo)

## 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 🚀

```bash
pip install pyrohelpo
```

## Usage ⚙️

### Basic Setup

```python
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

```python
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:

```python
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

```python
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

```python
@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:

```python
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 instance
- `modules_path`: Path to modules directory
- `buttons_per_page`: Number of buttons per page
- `help_var`: Variable name for help text (default: "**HELP**")
- `module_var`: Variable name for module name (default: "**MODULE**")
- `photo`: Optional photo URL/path
- `video`: Optional video URL/path
- `parse_mode`: Message parse mode
- `disable_web_page_preview`: Web preview setting
- `texts`: Customizable text dictionary
- `short_help`: Boolean to enable short help mode

#### Methods:

- `load_modules()`: Loads all modules from the specified path
- `show_help_menu(chat_id: int, page: int = 1, message_id: int = None)`: Displays the main help menu
- `show_module_help(query_or_message, module_name: str)`: Shows help for a specific module
- `send_message(chat_id: int, text: str, reply_markup: InlineKeyboardMarkup = None, message_id: int = None)`: Sends a message with optional media and keyboard
- `monkeypatch_client()`: Patches the Pyrogram client to handle the `/help` command

## Error Handling

Helpo includes comprehensive error handling for:

- Invalid module files
- Missing required attributes
- Media loading failures
- Message sending errors
- Callback query processing

## Contributors 👥

- [vishal-1756](https://github.com/vishal-1756)
- [siyu-xd](https://github.com/siyu-xd)

## License 📄

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support 🤝

Need help? Join our [support chat](https://t.me/Blank_Advice) or create an issue on our [GitHub repository](https://github.com/Vishal-1756/Helpo).

## Image Gallery 🖼️

---

Made with ❤️ by the Helpo team
<!---
# made by @Beingcat
--->

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vishal-1756/Helpo",
    "name": "pyrohelpo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "pyrogram, telegram, bot, pagination, help-menu",
    "author": "Vishal-1756",
    "author_email": "vishalborse199@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2d/1c/cb2d09d7b10a81d60864211e1e2eebb219a2735f8f7aaa28fb200c39ec67/pyrohelpo-4.1.4.tar.gz",
    "platform": null,
    "description": "# Helpo \ud83d\udcda\n\n![Image](https://socialify.git.ci/Vishal-1756/pyrohelpo/image?description=1&font=KoHo&name=1&owner=1&pattern=Charlie%20Brown&theme=Dark)\n\nA powerful and flexible pagination library for Pyrogram bots that automatically handles help commands and module organization.\n\n![Python](https://img.shields.io/badge/Python-3.7%2B-blue)\n![Pyrogram](https://img.shields.io/badge/Pyrogram-2.0%2B-green)\n![License](https://img.shields.io/badge/License-MIT-yellow)\n![PyPI Downloads](https://static.pepy.tech/badge/pyrohelpo)\n\n## Features \u2728\n\n- \ud83d\udd04 Automatic module discovery and help text organization\n- \ud83d\udcf1 Beautiful paginated help menus with inline buttons\n- \ud83c\udfaf Support for both command-based and button-based help\n- \ud83c\udfa8 Customizable button layouts and texts\n- \ud83d\udd0c Easy integration with existing Pyrogram bots\n- \ud83d\udcdd Support for rich media in help messages (photos, videos)\n- \ud83d\udd17 Deep linking support for direct access to help menus\n- \ud83c\udf10 Group chat support with private message options\n- \ud83c\udfad Flexible parse mode selection\n- \ud83d\uddbc\ufe0f Media support with photo and video options\n\n## Installation \ud83d\ude80\n\n```bash\npip install pyrohelpo\n```\n\n## Usage \u2699\ufe0f\n\n### Basic Setup\n\n```python\nfrom pyrogram import Client\nfrom Helpo import Helpo\nfrom pyrogram.enums import ParseMode\n\n# Initialize your Pyrogram client\napp = Client(\"my_bot\")\n\n# Initialize Helpo\nhelpo = Helpo(\n    client=app,\n    modules_path=\"plugins\",\n    buttons_per_page=6\n)\n```\n\n### Advanced Configuration\n\n```python\njson \ncustom_texts = {\n    \"help_menu_title\": \"**\ud83d\udee0 Custom Help Menu**\",\n    \"help_menu_intro\": \"Available modules ({count}):\\n{modules}\\n\\nTap on a module to explore.\",\n    \"module_help_title\": \"**\ud83d\udd0d Details for {module_name} Module**\",\n    \"module_help_intro\": \"Description:\\n{help_text}\",\n    \"no_modules_loaded\": \"\u26a0\ufe0f No modules available at the moment.\",\n    \"back_button\": \"\u25c0\ufe0f Go Back\",\n    \"prev_button\": \"\u2b05\ufe0f Previous Page\",\n    \"next_button\": \"\u27a1\ufe0f Next Page\",\n    \"support_button\": \"\ud83d\udcac Contact Support\",\n    \"support_url\": \"https://t.me/YourSupportBot\",\n    \"short_help\": True,\n    \"support_as_callback\": True,\n    \"support_c_back_name\": \"say_hi\"\n}\n\nhelpo = Helpo(\n    client=app,\n    modules_path=\"plugins\",\n    buttons_per_page=6,\n    texts=custom_texts,\n    help_var=\"HELP\",\n    module_var=\"MODULE\",\n    photo=\"path/to/photo.jpg\",  # Optional: Add photo to help messages\n    video=\"path/to/video.mp4\",  # Optional: Add video to help messages\n    parse_mode=ParseMode.HTML,  # Optional: Change parse mode (default: MARKDOWN)\n    disable_web_page_preview=False,  # Optional: Enable web preview (default: True)\n    short_help=True  # Optional: Enable short help mode\n)\n```\n\n### Module Setup\n\nCreate Python files in your modules directory with the following structure:\n\n```python\nMODULE = \"Admin\"  # Module name displayed in help menu\nHELP = \"\"\"\n**Admin Commands**\n/ban - Ban a user\n/unban - Unban a user\n/mute - Mute a user\n/unmute - Unmute a user\n\"\"\"\n```\n\n### Custom Class Implementation\n\n```python\nfrom pyrogram import Client\nfrom Helpo import Helpo\n\nclass Bot(Client):\n    def __init__(self):\n        super().__init__(\n            \"my_bot\",\n            api_id=API_ID,\n            api_hash=API_HASH,\n            bot_token=BOT_TOKEN\n        )\n        self.helpo = Helpo(\n            client=self,\n            modules_path=\"plugins\",\n            buttons_per_page=6,\n            texts=custom_texts\n        )\n\n    async def start(self):\n        await super().start()\n        print(\"Bot Started\")\n        print(f\"Loaded Modules: {', '.join(self.helpo.modules.keys())}\")\n\n    async def stop(self):\n        await super().stop()\n        print(\"Bot Stopped\")\n```\n\n### Group Chat Support\n\nHelpo automatically handles group chats by providing options to:\n\n- View help menu in private chat\n- View help menu directly in the group\n- Customize group chat behavior through the texts dictionary\n\n### Deep Linking Support\n\n```python\n@app.on_message(filters.command(\"start\"))\nasync def start_command(client, message):\n    if len(message.text.split()) > 1:\n        param = message.text.split(None, 1)[1]\n        if param == \"help\":\n            await client.show_help_menu(message.chat.id)\n    else:\n        await message.reply(\"Welcome! Use /help to see available commands.\")\n```\n\n### Monkeypatch Client\n\nTo automatically handle the `/help` command in your bot, you can use the `monkeypatch_client` method:\n\n```python\nfrom pyrogram import Client\nfrom Helpo import Helpo\n\napp = Client(\"my_bot\")\n\nhelpo = Helpo(\n    client=app,\n    modules_path=\"plugins\",\n    buttons_per_page=6,\n    texts=custom_texts\n)\n\nhelpo.monkeypatch_client()\n\napp.run()\n```\n\n## Methods and Attributes \ud83d\udcda\n\n### Helpo Class\n\n#### Attributes:\n\n- `client`: Pyrogram Client instance\n- `modules_path`: Path to modules directory\n- `buttons_per_page`: Number of buttons per page\n- `help_var`: Variable name for help text (default: \"**HELP**\")\n- `module_var`: Variable name for module name (default: \"**MODULE**\")\n- `photo`: Optional photo URL/path\n- `video`: Optional video URL/path\n- `parse_mode`: Message parse mode\n- `disable_web_page_preview`: Web preview setting\n- `texts`: Customizable text dictionary\n- `short_help`: Boolean to enable short help mode\n\n#### Methods:\n\n- `load_modules()`: Loads all modules from the specified path\n- `show_help_menu(chat_id: int, page: int = 1, message_id: int = None)`: Displays the main help menu\n- `show_module_help(query_or_message, module_name: str)`: Shows help for a specific module\n- `send_message(chat_id: int, text: str, reply_markup: InlineKeyboardMarkup = None, message_id: int = None)`: Sends a message with optional media and keyboard\n- `monkeypatch_client()`: Patches the Pyrogram client to handle the `/help` command\n\n## Error Handling\n\nHelpo includes comprehensive error handling for:\n\n- Invalid module files\n- Missing required attributes\n- Media loading failures\n- Message sending errors\n- Callback query processing\n\n## Contributors \ud83d\udc65\n\n- [vishal-1756](https://github.com/vishal-1756)\n- [siyu-xd](https://github.com/siyu-xd)\n\n## License \ud83d\udcc4\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support \ud83e\udd1d\n\nNeed help? Join our [support chat](https://t.me/Blank_Advice) or create an issue on our [GitHub repository](https://github.com/Vishal-1756/Helpo).\n\n## Image Gallery \ud83d\uddbc\ufe0f\n\n---\n\nMade with \u2764\ufe0f by the Helpo team\n<!---\n# made by @Beingcat\n--->\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A powerful pagination library for Pyrogram bots",
    "version": "4.1.4",
    "project_urls": {
        "Homepage": "https://github.com/vishal-1756/Helpo"
    },
    "split_keywords": [
        "pyrogram",
        " telegram",
        " bot",
        " pagination",
        " help-menu"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d76491e435cbdafe4bb7cc3f707fb5ee14a2bf0ff379cb37112f67d770966228",
                "md5": "3586204eab753c5e5184132b6c530b00",
                "sha256": "a0a454b0bfc84befc0381c42196b66d72e951052e39f29ccf5b2a340aefaf38c"
            },
            "downloads": -1,
            "filename": "pyrohelpo-4.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3586204eab753c5e5184132b6c530b00",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11559,
            "upload_time": "2024-12-15T10:09:30",
            "upload_time_iso_8601": "2024-12-15T10:09:30.012536Z",
            "url": "https://files.pythonhosted.org/packages/d7/64/91e435cbdafe4bb7cc3f707fb5ee14a2bf0ff379cb37112f67d770966228/pyrohelpo-4.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d1ccb2d09d7b10a81d60864211e1e2eebb219a2735f8f7aaa28fb200c39ec67",
                "md5": "113b86a09137553b305951b3446586b2",
                "sha256": "7067f616fc380588ac1cfc5790819f750d1f8d20fc76d5fa6af1d897fd67bed6"
            },
            "downloads": -1,
            "filename": "pyrohelpo-4.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "113b86a09137553b305951b3446586b2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 10463,
            "upload_time": "2024-12-15T10:09:32",
            "upload_time_iso_8601": "2024-12-15T10:09:32.426452Z",
            "url": "https://files.pythonhosted.org/packages/2d/1c/cb2d09d7b10a81d60864211e1e2eebb219a2735f8f7aaa28fb200c39ec67/pyrohelpo-4.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-15 10:09:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vishal-1756",
    "github_project": "Helpo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pyrogram",
            "specs": [
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "TgCrypto",
            "specs": [
                [
                    ">=",
                    "1.2.0"
                ]
            ]
        }
    ],
    "lcname": "pyrohelpo"
}
        
Elapsed time: 0.36154s