Skip to main content

A python wrapper for bale api

Project description

pyrobaletext

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 Support - Both synchronous and asynchronous operations

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: User):
    await message.reply("Hello, world!")

bot.run()

Examples

Conversation Bot

from pyrobale.objects import *
from pyrobale.client import Client, Message, UpdatesTypes
import asyncio

client = Client("YOUR_BOT_TOKEN")

async def handle_message(message: Message):
    if message.text == "/start":
        await message.reply("سلام! من یک ربات PyRoBale هستم!")
        await client.wait_for(UpdatesTypes.MESSAGE)
        await message.reply("Okay! wait_for Test Compeleted")

client.add_handler(UpdatesTypes.MESSAGE, handle_message)

client.run()

Echo Bot

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()

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://google.com")
    buttons.add_button("Callback", callback_data="callback")
    buttons.add_row()
    buttons.add_button("WebApp", web_app="https://daradege.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.

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

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

pyrobale-0.3.7.tar.gz (53.7 kB view details)

Uploaded Source

Built Distribution

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

pyrobale-0.3.7-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file pyrobale-0.3.7.tar.gz.

File metadata

  • Download URL: pyrobale-0.3.7.tar.gz
  • Upload date:
  • Size: 53.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pyrobale-0.3.7.tar.gz
Algorithm Hash digest
SHA256 e98fcec15ef175a37fbce987e51646cc8a78c5cbf4637b441d939f198a1a7e18
MD5 b5b9ae66f3adbcf162035cc5049e8973
BLAKE2b-256 e863f7c89dc65b6958bff7e0cec98f420dca92cc0eaacacb56946147bc48faa1

See more details on using hashes here.

File details

Details for the file pyrobale-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: pyrobale-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.12

File hashes

Hashes for pyrobale-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0b3074253905ae11d1ef73b2fbe5f52db783e99589913a40cf645a408b26f0f9
MD5 83a2798a6b1312fa81276353521a0030
BLAKE2b-256 269116561da4130a6424a238b59aedf9aab54885572240be8f73f8b22158cc99

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 Pingdom Monitoring Sentry Error logging StatusPage Status page