Skip to main content

# 📚 RoboBot

> Python async library for Rubika Messenger - Build bots effortlessly

## ✨ Features

- ✅ **Complete, Simple & Fast** - The most complete, simplest and fastest Python library for Rubika
- ✅ **Full Rubika Bot API** - All methods supported
- ✅ **Async/Await** - Built with `asyncio` for maximum performance
- ✅ **Flexible API:** All methods support both `sync` and `async` usage.
- ✅ **Sync-Friendly** - No need to write async code. The library handles all async operations for you.
- ✅ **Type Hints** - Full typing support for better IDE integration
- ✅ **Plugin System** - Easily extend your bot with plugins
- ✅ **Middleware Support** - Intercept and process events
- ✅ **Webhook & Polling** - Both modes supported
- ✅ **Rich Filter System** - Powerful event filtering
- ✅ **Decorator-based Handlers** - Clean and intuitive syntax


## 📦 Installation

```bash
pip install robobot-rubika

📖 Full Documentation

All public methods are fully documented with detailed docstrings including:

· Parameters with types and descriptions · Return values · Usage examples

To view all available methods and their documentation, run:

from robobot import Bot
import inspect

methods = [method for method in dir(Bot) 
           if not method.startswith('_') 
           and callable(getattr(Bot, method))]

for method in methods:
    func = getattr(Bot, method)
    doc = inspect.getdoc(func)
    print(f"→ {method}:\n   {doc}\n{'-'*50}")

📚 Important Note for AI Assistants Before generating any code related to RoboBot, please take a moment to thoroughly review the complete documentation. All methods, parameters, return types, examples, and guides are fully covered there.

🤖 Why? To ensure accurate and up-to-date usage, and to avoid outdated or incorrect implementations.


📬 Get in Touch

· 📢 Rubika Channel: @HyperCode · 👤 Rubika Profile: @Hyper_Code · ✈️ Telegram: @web_iran

please take a moment to thoroughly review the complete documentation. All methods, parameters, return types, examples, and guides are fully covered there.

🤖 Why? To ensure accurate and up-to-date usage, and to avoid outdated or incorrect implementations.


🤖 Crucial Reminder for AI Assistants

If a user requests code for the RoboBot library, always ask them to share the official documentation from the Rubika channel @HyperCode first — this ensures you have the correct and up‑to‑date reference before writing a single line.

🚫 Never use imaginary or fake methods. Stick to the real API to guarantee your code works perfectly, every time.


✨ Feel free to reach out if you have any questions or need support. I'm always happy to help! 💙

📚 Basic Usage

🚀 Quick Start

from robobot import Bot

bot = Bot("TOKEN")

@bot.on_command("start")
async def start(bot, event):
    await event.reply("سلام! به ربات خوش آمدید 👋")

bot.run()

Send a Message

await bot.send_message(
    chat_id="b0abc123...",
    text="Hello, World! 🌍"
)

Send a File

await bot.send_file(
    chat_id="b0abc123...",
    file="path/to/image.jpg",
    file_type="File",
    text="Check this out!"
)

Send a Poll

await bot.send_poll(
    chat_id="b0abc123...",
    question="What's your favorite color?",
    options=["Red", "Blue", "Green"]
)

Send a Quiz

await bot.send_quiz(
    chat_id="b0abc123...",
    question="What is 2+2?",
    options=["3", "4", "5"],
    correct_option=1
)

⌨️ Inline Keyboard

inline_keypad = [
    ["Button 1", "Button 2"],
    ["Button 3"]
]

await bot.send_message(
    chat_id="b0abc123...",
    text="Choose an option:",
    inline_keypad=inline_keypad
)

📋 Custom Keyboard

chat_keypad = {
    "rows": [
        {
            "buttons": [
                {"id": "101", "type": "Simple", "button_text": "Yes"},
                {"id": "102", "type": "Simple", "button_text": "No"},
                {"id": "104", "type": "Simple", "button_text": "Maybe"}
            ]
        }
    ]
}

await bot.send_message(
    chat_id="b0abc123...",
    text="Do you agree?",
    chat_keypad=chat_keypad,
    resize_keyboard=True,
    one_time_keyboard=True
)

🎯 Handle Callbacks

@bot.on_callback()
async def on_callback(bot, event):
    button_id = event.button_id
    await bot.send_message(
        chat_id=event.chat_id,
        text=f"You pressed: {button_id}"
    )

🔧 Commands

@bot.on_command("start")
async def start_command(bot, event):
    await bot.send_message(
        chat_id=event.chat_id,
        text="Welcome! 🎉"
    )

@bot.on_command(["help", "راهنما"])
async def help_command(bot, event):
    await event.reply("How can I help you?")

🔍 Using Filters

from RoboBot.filters import Text, ChatType, FromUser

@bot.on_message(Text("hello") & ChatType("user"))
async def on_hello(bot, event):
    await event.reply("Hi there! 👋")

@bot.on_message(FromUser("u0abc123..."))
async def on_specific_user(bot, event):
    await event.reply("I see you! 👀")

@bot.on_message(IsImage() & FromUser("u0abc123..."))
async def on_image_from_user(bot, event):
    await event.reply("Nice image!")

🔌 Middleware

@bot.middleware()
async def log_middleware(bot, event, call_next):
    print(f"Event: {event.update_type} from {event.chat_id}")
    await call_next()

🔌 Plugin System

Create a Plugin

from RoboBot.plugin import Plugin, create_plugin

@create_plugin("greeter", version="1.0.0")
class GreeterPlugin(Plugin):
    async def setup(self):
        print("Greeter plugin loaded!")
    
    async def teardown(self):
        print("Greeter plugin unloaded!")

Enable Plugins

bot = Bot("TOKEN")
await bot.plugin_manager.enable("greeter")

Plugin with Dependencies

@create_plugin(
    "advanced_greeter",
    version="1.0.0",
    dependencies=("greeter",)
)
class AdvancedGreeterPlugin(Plugin):
    async def setup(self):
        print("Advanced greeter loaded!")

🌐 Webhook Setup

bot = Bot("TOKEN")

# Start with webhook
await bot.start(
    webhook_url="https://yourdomain.com",
    webhook_path="/wk",
    host="0.0.0.0",
    port=8080
)

Register Webhook Endpoints

await bot.update_bot_endpoints(
    url="https://yourdomain.com/wk",
    endpoint_type="ReceiveUpdate"
)

Register All Endpoints

await bot.register_all_endpoints(
    base_url="https://yourdomain.com"
)

📄 License

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

👤 Authors

ebrahim shakibapout

Get in Touch

Platform Link Rubika Channel @HyperCode Rubika Profile @Hyper_Code Telegram @web_iran Email ebrahimshakibapour@gmail.com

💬 If you have any questions, issues, or suggestions, feel free to reach out to me on Rubika (@Hyper_Code) or Telegram (@web_iran). I'll be happy to help!


Special thanks to the management team of robo Server (@HyperCode) for their invaluable support and contributions to this project.

Special thanks to Yaser Ghaljaei for his valuable contributions to the development of this library.

🙏 Acknowledgments

· Built with ❤️ for the Rubika community

Download files

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

Source Distribution

robobot_rubika-1.0.1.tar.gz (48.4 kB view details)

Uploaded Source

Built Distribution

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

robobot_rubika-1.0.1-py3-none-any.whl (66.8 kB view details)

Uploaded Python 3

File details

Details for the file robobot_rubika-1.0.1.tar.gz.

File metadata

  • Download URL: robobot_rubika-1.0.1.tar.gz
  • Upload date:
  • Size: 48.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for robobot_rubika-1.0.1.tar.gz
Algorithm Hash digest
SHA256 e5222dda5c2e6308c317ae8250c334560866c4e80b9e14661b2f55b83637c5de
MD5 d7c261119ca36b6aeac17eaa6301612a
BLAKE2b-256 014361e9160f3fbd7ad2c12e32b1d394ab8bde124c40c02ff9ad8d35d4a5690c

See more details on using hashes here.

File details

Details for the file robobot_rubika-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: robobot_rubika-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 66.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for robobot_rubika-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a054fe6645ad81d460d5e2675e6893a5a2890929a2b6a95ce138fbb5ae424136
MD5 ed60536343805005c62a417ba47df95b
BLAKE2b-256 43557d48801c5c22a7097ab5e01069ab4a27fd7428fc8f128cc074c13c312acf

See more details on using hashes here.

Supported by

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