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.
Installation
pip install RubigramClient
Quick Example
from rubigram import Client
from rubigram.types import Update
client = Client(token="...")
@client.on_message()
async def start(client: Client, update: Update):
await update.reply(text="Hi, rubigram user!")
client.run()
Reply and Edit message
from rubigram import Client
from rubigram.types import Update
client = Client(token="...")
@client.on_message()
async def echo(client: Client, update: Update):
message = await update.reply(text=f"Hi, {update.new_message.text}")
await message.edit_text(text="message was edited")
client.run()
Send Message & Get receiveInlineMessage
from rubigram import Client, filters
from rubigram.types import Update, Button, Keypad, KeypadRow, InlineMessage
client = Client(token="...", webhook_url="...")
@client.on_message(filters.command("start"))
async def start(client: Client, update: Update):
inline = Keypad(
rows=[
KeypadRow(
buttons=[
Button(id="1", button_text="Button 1"),
Button(id="2", button_text="Button 2")
]
)
]
)
await update.reply("The inline message", inline_keypad=inline)
@client.on_inline_message(filters.button(["1", "2"]))
async def button(client: Client, update: InlineMessage):
if update.aux_data.button_id == "1":
await client.send_message(chat_id=update.chat_id, text="You Click Button 1")
elif update.aux_data.button_id == "2":
await client.send_message(chat_id=update.chat_id, text="You Click Button 2")
client.run()
Filters
from rubigram import Client, filters
from rubigram.types import Update
client = Client(token="...")
@client.on_message(filters.text)
async def text(client: Client, update: Update):
await update.reply(text="message is text")
@client.on_message(filters.contact)
async def contact(client: Client, update: Update):
await update.reply(text="message is contact")
@client.on_message(filters.edited)
async def edited(client: Client, update: Update):
await update.reply(text="message is edited")
@client.on_message(filters.file)
async def file(client: Client, update: Update):
await update.reply(text="message is efiledited")
client.run()
Contex Manager
from rubigram import Client
import asyncio
async def main():
async with Client(token="...") as client:
data = await client.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=token) as client:
info = await client.get_me()
print(info)
asyncio.run(main())
Rubino
from rubigram.rubino import Rubino
import asyncio
async def main():
async with Rubino(auth="...") as client:
info = await client.get_my_profile_info()
print(info)
asyncio.run(main())
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
rubigramclient-1.7.4.tar.gz
(56.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rubigramclient-1.7.4.tar.gz.
File metadata
- Download URL: rubigramclient-1.7.4.tar.gz
- Upload date:
- Size: 56.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
725a400a3f229a039aa1ecb80cf2dd7844fac0bb5041ff6e75fd534639122d4c
|
|
| MD5 |
a4b646e75d62243f997d2de371aef5d4
|
|
| BLAKE2b-256 |
533fb950d3776baab3794aff15fab7bf6bbf24b1641489cafb48887b28e3827e
|
File details
Details for the file rubigramclient-1.7.4-py3-none-any.whl.
File metadata
- Download URL: rubigramclient-1.7.4-py3-none-any.whl
- Upload date:
- Size: 99.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8868f1a91d52489093eba88c1148720af22a329e5dfbc2e17750f1cdf51ca841
|
|
| MD5 |
df5cb21765aca1d4f081c5c15e0d3a27
|
|
| BLAKE2b-256 |
f2c72a7ce034488635a6cae8254570a07b240304c3faa5ca1cf1cfba1d918bd8
|