Skip to main content

Rubx Library For Rubika Iranina Messenger

Project description

RuBx
Rubika Client API Framework | Python 3
Document Telegram Rubika

[Rubx] - rubika messenger

Messenger:

from rb import RubikaClient # rb: is main package

with RubikaClient('session') as client:
   client.send_message('Hello From Rubx', 'chat-guid')

Or

from rb import RubikaClient as Client

def respond(callable, params) -> dict:
    return callable(**params)

with Client(...) as client:
    print(
        respond(
            client.send_message,
            dict(
                chat_id=...,
                text='**Hey** @User@ R U __My__ ``Friend`` and ~~My Love~~'
                mention_user_ids=['u0...']),
            )
        )
    
    # print(respond(client.send_message, dict(chat_id=..., sticker=True, emoji_character='😜', sticker_id=..., )))

Or

shorcuts

from rb import RubikaClient

with RubikaClient(...) as client:
    print(client == dict(text='Hey', chat_id='chat-guid')) # to send message
    # print(client * 'chat-guid') # to get chat info
    # use the operators

for: if you forget the method name

from rb import RubikaClient

with RubikaClient('session') as client:
    print(client.getChatInfo(client, 'chat-guid')) # GetChatInfo, GETchatINFO, or ...
    # normally: client.get_chat_info('chat-guid')

for show all operators and shortcuts go to docs

Rubino

from rb import RubinoClient

with RubinoClient('session') as app:
    app.create_page(...)

Handler

Handler Examples

from rb import Handler, EventBuilder, Filters

client = Handler(...)

# handlers: HandShake, ChatsUpdates, MessagesUpdates
client.add_event_handling(func='ChatsUpdates', events=dict(get_chats=True, get_messages=True, pattern=('/start', 'Hey from rubx lib.')))

@client.handler
def hello(app, message: EventBuilder, event):
    # to print message: print(message) or print(event)
    # to use all methods: app.create_objcet_voice_chat(...)
    message.respond(message.pattern, Filters.author) # filters: chat, group, channel, author

Or

from rb import Handler, NewMessage, Filters, EventBuilder, Performers

client = Handler(...)

@client.on(NewMessage(client.handle, handle_name=Performers.chats_updates).builder())
def update(event: EventBuilder):
    ... # event.respond('Hey', Filters.chat)

Or

from rb import Handler, Filters, Performers

client = Handler('session')

def event(message):
    message.respond(message.pattern, Filters.author)
        
client.add_event_handling(func=Performers.hand_shake, events=dict(get_chats=True, get_messages=True, pattern=('/start', 'Hi from rubx lib.')))
client.starting = True
client.command_handler(event)

To using HandShake(WebSocket):

from rb import Handler, EventBuilder, Filters, Performers

client = Handler('abc...', 'u0...')
client.add_event_handling(func=Performers.hand_shake, events=dict(get_messages=True, get_chats=False))
@client.handler
def update(app, update, event):
    if update.message.text == '/start':
        message.reply(text='Hello my dear', chat_id=update.message.author_object_guid, reply_to_message_id=update.message.message_id)
        # or using repond: message.respond('Hey!', Filters.author)

Async methods

from rb import Client # Client: asycn reader

async def run(*args):
    async with Client(...) as client:
        result = await client.start(client.send_message, 'Hey! from rubx', 'chat-guid')
        print(result)

Client.run(run)

How to get keys from result?

from rb import RubikaClient

with RubikaClient('session', return_data_an_dict=False) as client:
    print((client * 'chat-guid').data.chat) # get chat info: get data and get chat from a chat object

Rubx - ⚡

  • Now the best ‍sync‍ and asycn library for Rubika's was developed
  • ⭐️ Thanks everyone who has starred the project, it means a lot!

Rubx is an sync Python 3 rubika library to interact with Rubika's API as a user or through a bot account (self API alternative).

🔴 If you have code using Rubx before its 8.0.5 version, you must
read docs to learn how to migrate. 💡

What is this?

🇮🇷 - Rubika is a popular messaging application. This library is meant to make it easy for you to write Python programs that can interact with Rubika. Think of it as a wrapper that has already done the heavy job for you, so you can focus on developing an application. This module provides all the desired methods with a very simple and beautiful user interface and has a very high speed. Give your employer the best experience of a project.

Updating - 🌀 :

- Complete documentation and optimization.

INSTALLING

pip install rubx

UPGRADE

pip install rubx --upgrade

CREATED BY:

- saleh

self rubika client with python3 RUBX module


Python 3|2.7|3.x

License

Creator

Telegram


issues forks version stars license icon


special:

  • [RUBX] > a library 'official' for rubika messnger with client server.
  • [RUBX] > use api's rubika, and full methods.

to use it, your python must support type hint.

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

rubx-10.4.9.tar.gz (53.1 kB view details)

Uploaded Source

Built Distribution

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

rubx-10.4.9-py3-none-any.whl (55.6 kB view details)

Uploaded Python 3

File details

Details for the file rubx-10.4.9.tar.gz.

File metadata

  • Download URL: rubx-10.4.9.tar.gz
  • Upload date:
  • Size: 53.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for rubx-10.4.9.tar.gz
Algorithm Hash digest
SHA256 b0862ae0d5e8ccbbc1ff6c6cbce4d531eedef0eee960c88d5727f31a4a69278e
MD5 218a8a2d50cd54a712495478b2736174
BLAKE2b-256 efc900ea9e05e32ff7e14408b54b5dd314da5b27b5ae6c279d44a6dbd0f7443f

See more details on using hashes here.

File details

Details for the file rubx-10.4.9-py3-none-any.whl.

File metadata

  • Download URL: rubx-10.4.9-py3-none-any.whl
  • Upload date:
  • Size: 55.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for rubx-10.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 097bcbf42191caf9fa3931dd911d9eb6005f0369216aea4126d8ab064c79fd88
MD5 178ea2f1e1ff26e46a10500d352cff6d
BLAKE2b-256 c31239301e5fdc97807df7a201d954e5e172b2c889561427dfb2b7923ccb20f0

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