Pyrobale DocumentationΒΆ
API Documents
Bale Bot API Python LibraryΒΆ
A modern, easy-to-use Python wrapper for the Bale Bot API that makes building Bale bots simple and intuitive.
FeaturesΒΆ
π Simple & Intuitive β Clean, Pythonic API design
π¨ Full Message Support β Text, photos, videos, documents, and more
β¨οΈ Interactive Elements β Inline keyboards, reply keyboards, and buttons
π Real-time Updates β Webhook and polling support
π File Handling β Easy upload and download of media files
π‘οΈ Error Handling β Comprehensive exception handling
π Type Hints β Full typing support for better development experience
π Async & Sync Support β Works with both asynchronous and synchronous handlers
InstallationΒΆ
pip install pyrobale
Quick StartΒΆ
from pyrobale.client import Client
from pyrobale.objects import Message, UpdatesTypes
bot = Client("YOUR_BOT_TOKEN")
@bot.on_message()
async def message_handler(message: Message):
await message.reply("Hello, world!")
bot.run()
ExamplesΒΆ
Conversation BotΒΆ
from pyrobale.objects import *
from pyrobale.client import Client, Message, UpdatesTypes
client = Client("YOUR_BOT_TOKEN")
async def handle_message(message: Message):
if message.text == "/start":
await message.reply("Hi! I'm a pyrobale RoBot!")
await client.wait_for(UpdatesTypes.MESSAGE)
await message.reply("Okay! wait_for test completed")
client.add_handler(UpdatesTypes.MESSAGE, handle_message)
client.run()
Echo Bot (Async)ΒΆ
from pyrobale.client import Client
from pyrobale.objects import Message, UpdatesTypes
bot = Client("YOUR_BOT_TOKEN")
@bot.on_message()
async def message_handler(message: Message):
await message.reply(message.text)
bot.run()
Echo Bot (Sync)ΒΆ
You can also use synchronous handlers β the library handles them automatically.
from pyrobale.client import Client
from pyrobale.objects import Message, UpdatesTypes
bot = Client("YOUR_BOT_TOKEN")
@bot.on_message()
def message_handler(message: Message):
message.reply(message.text)
bot.run()
Inline KeyboardΒΆ
from pyrobale.client import Client
from pyrobale.objects import Message, UpdatesTypes, InlineKeyboardButton, InlineKeyboardMarkup, CopyTextButton
bot = Client("YOUR_BOT_TOKEN")
async def message_handler(message: Message):
buttons = InlineKeyboardMarkup()
buttons.add_button("URL", url="https://pyrobale.ir")
buttons.add_button("Callback", callback_data="callback")
buttons.add_row()
buttons.add_button("WebApp", web_app="https://pyrobale.ir")
buttons.add_button("Copy", copy_text_button=CopyTextButton("TEXT"))
await message.reply("Hello, world!", reply_markup=buttons)
Core AbilitiesΒΆ
Message Handling β Process text, commands, and media messages
Callback Queries β Handle inline keyboard interactions
File Operations β Send and receive photos, videos, documents
Chat Management β Get chat info, member management
Custom Keyboards β Create interactive user interfaces
Webhook Support β Production-ready webhook handling
Middleware Support β Add custom processing layers
DocumentationΒΆ
For detailed documentation and advanced usage, visit our documentation site:
pyrobale.readthedocs.io (Global)
docs.pyrobale.ir (IR Server)
ContributingΒΆ
Contributions are welcome! Please feel free to submit a Pull Request.
LicenseΒΆ
This project is licensed under the MIT License β see the LICENSE file for details.
SupportΒΆ
π Docs (IR Server) β Docs (Global)
π Issue Tracker
π¬ Discussions