Skip to main content

A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.

Project description

Rubigram

A lightweight Python library to build Rubika bots easily.

Rubigram Logo

Installation

pip install RubigramClient

Quick Example

from rubigram import Client

bot = Client(token="YOUR_TOKEN")

@bot.on_message()
async def handler(client, message):
    await message.reply("Hello Rubigram!")

bot.run()

Reply and Edit message

from rubigram import Client, filters
from rubigram.types import Update

bot = Client(token="YOUR_TOKEN_BOT")

@bot.on_message(filters.private)
async def echo(client, message: Update):
    send = await message.reply(f"Hi, {message.new_message.text}")
    await send.edit_text("message was edited")

bot.run()

Send Message & Get receiveInlineMessage

from rubigram import Client, filters
from rubigram.types import Update, Button, Keypad, KeypadRow, InlineMessage


bot = Client(token="BOT_TOKEN", endpoint="ENDPOINT_URL")


@bot.on_message(filters.command("start"))
async def start(_, message: Update):
    inline = Keypad(
        rows=[
            KeypadRow(
                buttons=[
                    Button("1", "Button 1"),
                    Button("2", "Button 2")
                ]
            )
        ]
    )
    await bot.send_message(message.chat_id, "Hi", inline_keypad=inline)
    

@bot.on_inline_message(filters.button(["1", "2"]))
async def button(_, message: InlineMessage):
    if message.aux_data.button_id == "1":
        await bot.send_message(message.chat_id, "You Click Button 1")
    elif message.aux_data.button_id == "2":
        await bot.send_message(message.chat_id, "You Click Button 2")
        
bot.run()

Contex Manager

from rubigram import Client
import asyncio

bot = Client("YOUR_BOT_TOKEN")

async def main():
    async with bot:
        data = await bot.get_me()
        print(data.bot_id)

asyncio.run(main())

Implementation of multiple programs

from rubigram import Client
import asyncio

tokens = [
    "TOKEN_1",
    "TOKEN_2"
]

async def main():
    for token in tokens:
        async with Client(token) as bot:
            get_me = await bot.get_me()
            print(get_me.asjson())

asyncio.run(main())

Rubino

from rubigram.rubino import Rubino
import asyncio

async def main():
    auth = "YOUR_AUTH_ACCOUNT"
    async with Rubino(auth) as app:
        info = await app.get_my_profile_info()
        print(info)
        
asyncio.run(main())

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

rubigramclient-1.7.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

rubigramclient-1.7.1-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file rubigramclient-1.7.1.tar.gz.

File metadata

  • Download URL: rubigramclient-1.7.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rubigramclient-1.7.1.tar.gz
Algorithm Hash digest
SHA256 4f41427585858e1fb6543c857050bbe57ae9a91bf14af69f901c587c5a3c7239
MD5 8d1675ba381f6801b253e83190d31602
BLAKE2b-256 c83d8ba73a3505eac2974edb22560e50980b1ce66974f32b15c9bee5206488cd

See more details on using hashes here.

File details

Details for the file rubigramclient-1.7.1-py3-none-any.whl.

File metadata

  • Download URL: rubigramclient-1.7.1-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for rubigramclient-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b68d9f03cfc213bdaa3ce9e6a88c132bf689a7e1f5b777a010f5a5da1213b8a9
MD5 bbb3af8c73633374ad3ff76cbcdd52c6
BLAKE2b-256 47653d1ff7fd610ca2d42afabbfd788fb5e7425cd2e8b4f1bd5d6b39ee81d4a1

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