Skip to main content

A Python library for interacting with the Rubika bot API.

Project description

rubxy

rubxy is a Python library for interacting with the Rubika bot API.
It makes it easy to send and receive messages, handle events, and build bots quickly.


Features

  • Send and receive messages via Rubika API
  • Easy-to-use event handlers
  • Fully asynchronous & Support sync

Installation

pip install rubxy

Async Usage

  • Messages Updates

    from rubxy import Client, filters
    from rubxy.types import Update
    
    client = Client(bot_token="BOT_TOKEN")
    
    @client.on_message(filters.commands("start"))
    async def start_handler(client: Client, update: Update):
        await update.reply("Hello from rubxy")
    
    # Run in long-polling mode
    client.run()
    
    # Or run in webhook mode (recommended)
    client.run(endpoint="https://example.com")
    
  • Inline Updates

    from rubxy import Client, filters
    from rubxy.types import InlineMessage
    
    client = Client(bot_token="BOT_TOKEN")
    
    @client.on_inline_message(filters.regex("^button-(\w+)"))
    async def inline_message_handler(client: Client, i: InlineMessage):
        await i.answer(
            text="you clicked button-id: {}".format(
                i.matches[0].group(1)
            )
        )
    
    # Run in long-polling mode
    client.run()
    
    # Or run in webhook mode (recommended)
    client.run(endpoint="https://example.com")
    

Sync Usage

  • Messages Updates

    from rubxy import Client, filters
    from rubxy.types import Update
    
    client = Client(bot_token="BOT_TOKEN")
    
    @client.on_message(filters.commands("start"))
    def start_handler(client: Client, update: Update):
        update.reply("Hello from rubxy")
    
    # Run in long-polling mode
    client.run()
    
    # Or run in webhook mode (recommended)
    client.run(endpoint="https://example.com")
    
  • Inline Updates

    from rubxy import Client, filters
    from rubxy.types import InlineMessage
    
    client = Client(bot_token="BOT_TOKEN")
    
    @client.on_inline_message(filters.regex("^button-(\w+)"))
    def inline_message_handler(client: Client, i: InlineMessage):
        i.answer(
            text="you clicked button-id: {}".format(
                i.matches[0].group(1)
            )
        )
    
    # Run in long-polling mode
    client.run()
    
    # Or run in webhook mode (recommended)
    client.run(endpoint="https://example.com")
    

Project details


Download files

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

Source Distribution

rubxy-1.0.0.tar.gz (39.3 kB view details)

Uploaded Source

Built Distribution

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

rubxy-1.0.0-py3-none-any.whl (66.6 kB view details)

Uploaded Python 3

File details

Details for the file rubxy-1.0.0.tar.gz.

File metadata

  • Download URL: rubxy-1.0.0.tar.gz
  • Upload date:
  • Size: 39.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rubxy-1.0.0.tar.gz
Algorithm Hash digest
SHA256 19683f83239e4aa3c31861a1777070639ba56e72fa0a88a3a0520c96f2c5bf33
MD5 fc810595a18f8da4151c8892b8a2a4e2
BLAKE2b-256 9cc5415bcbad286e7b356a46e65c4b271951a9dc8199a109aa5bcab75c44b41f

See more details on using hashes here.

File details

Details for the file rubxy-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rubxy-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 66.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for rubxy-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d5db83ca892f53856e1fbec5f1441d576fec0e7c65e8196328ca31fc1cecdba
MD5 9cad0f241ce10e743319744e5afef026
BLAKE2b-256 1c0c2d98ecd0076ca105e28f9bd2f359e5b37b8f77c4e97c4fc7ab333e6a88d9

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