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-0.1.5.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

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

rubxy-0.1.5-py3-none-any.whl (63.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for rubxy-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f24aa9d9f50090eb72dd83e966d87a638043e20b3372b50134e23265cfa8aae1
MD5 e99a736de6a3ef2cb41dfa1f27391abd
BLAKE2b-256 672debb5d040fff3171e7243d1d68dcc5a12a46e2b88e464b4b01c59b00dfb41

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for rubxy-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8319d53a4d09d8d958c1b80548e765bb17f0d119f48ad3d012102bbc28f3f43d
MD5 6bfbb446af21612bee07cac9d02e1fc5
BLAKE2b-256 39cee99f1cca13823d08b05cc08aa88437360c6202b965f65b77772028cfdd73

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