Rubigram
Rubigram is a powerful asynchronous Python framework for building advanced bots on Rubika, offering features like concurrent message handling, advanced filtering, and support for both webhooks and polling.
Features
- Asynchronous and fast: handle multiple messages concurrently.
- Advanced filters for private chats, commands, and text messages.
- Easy message and media sending (text, images, videos, files).
- Support for both webhooks and polling.
- Interactive keyboards and buttons for better user engagement.
- Flexible integration with databases for storing settings and data.
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()
Use webhook and run a server
from rubigram import Client, Server, types, filters
client = Client(token="...", webhook="...")
server = Server(client, host="127.0.0.1", port=8080)
@client.on_message(filters.command("start"))
async def start(client: Client, update: types.Update):
await update.reply("```import rubigram\n\nprint(rubigram.__version__)```")
@client.on_start()
async def start(client):
print("start bot ....")
@client.on_stop()
async def stop(client):
print("stop bot")
server.run_server()
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()
Handlers
from rubigram import Client
client = Client(token="...")
@client.on_message()
async def new_message():
...
@client.on_inline_message()
async def inline_message():
...
@client.on_update_message()
async def update_message():
...
@client.on_remove_message()
async def remove_message():
...
@client.on_started_bot()
async def start_bot():
...
@client.on_stopped_bot()
async def stop_bot():
...
@client.on_start()
async def start():
...
@client.on_stop()
async def stop():
...
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())
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.11.tar.gz
(62.9 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.11.tar.gz.
File metadata
- Download URL: rubigramclient-1.7.11.tar.gz
- Upload date:
- Size: 62.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4c1aab57629ce4b03c570e9b4cb3efe88d2137caa58fd3d766d9cd7c04ab959
|
|
| MD5 |
7a09c5caabb10166a04608dcd77f2f32
|
|
| BLAKE2b-256 |
77d06f9332082b4efb4abd38a7ac8fa74bf6792216b41eebeae4d9784871ff0a
|
File details
Details for the file rubigramclient-1.7.11-py3-none-any.whl.
File metadata
- Download URL: rubigramclient-1.7.11-py3-none-any.whl
- Upload date:
- Size: 120.9 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 |
07aa4756657b201b52d2668ab73633a357ab22c97ae03d3fbbe7f9c9b4fd95c6
|
|
| MD5 |
9b9e4b58488a5b421b6a7695f36e3692
|
|
| BLAKE2b-256 |
a31162df15c8e5bcff0fa8d718612ce7580ab34fc126c2feca5dcec6a5a51716
|