rubx


Namerubx JSON
Version 10.6.9 PyPI version JSON
download
home_pagehttps://github.com/mester-root/rubx
SummaryIranian rubx library - rubika client module
upload_time2023-05-08 13:15:04
maintainer
docs_urlNone
authorSaleh
requires_python~=3.9
licenseMIT
keywords messenger python self rubx rubix rubikax rubika bot robot library rubikalib rubikalibrary rubika.ir web.rubika.ir telegram
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<p align="center">
    <a href="https://github.com/mester-root/rubx">
        <img src="https://raw.githubusercontent.com/Mester-Root/rubx/main/icons/rubx-action.png" alt="RuBx" width="420">
    </a>
    <br>
    <b>Rubika Client API Framework | Python 3</b>
    <br>
    <a href="https://github.com/Mester-Root/rubx/blob/main/README.md">
        Document
    </a>
     •
    <a href="https://t.me/rubx_library">
        Telegram
    </a>
     •
    <a href="https://rubika.ir/TheClient">
        Rubika
    </a>
</p>


# Rubx | Rubika Client 

## Messenger Methods:

```python

from rb import RubikaClient # rb: is main package

with RubikaClient('session', platform='rubx',) as client: # set the proxy, api client, api version, ...
   client.send_message('Hey There!', 'username') # username, chat id, prviate links

```

### Or

```python
from rb import RubikaClient

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

with RubikaClient(...) as client:
    print(
        respond(
            client.send_message,
            dict(
                chat_id=...,
                text='**Hey** @User@  __My__ ``Friend`` ~~How r u?~~'
                mention_user_ids=['u0...']),
            )
        )

    # for emoji
    # print(respond(client.send_message, dict(chat_id=..., sticker=True, emoji_character='😜', sticker_id=..., )))
```

### Or

```python
# shorcuts

from rb import RubikaClient
from rb.responses import Self

with RubikaClient(...) as client:
    print(client == Self.Text(text='Hey', chat_id='chat-guid')) # to send a message
    
    # print(client * 'chat-guid') # to get chat info
    # print(client['chat-guid']) # to get a message from chat
    # client['send_message'] = dict(text='Hey there', chat_id='chat-guid') # example to usage methods with setitem
    # use the all operators

```

### if you forget the method name
```python
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')
```


## Rubino Methods:

``` python

from rb import RubinoClient

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

```

## Handler Methods:

### Handler Examples

```python
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

```python
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):

```python
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:

```python
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)
```


## Bot API Methods:

### example for api methods send message text
```python
from rb import BotAPI

with BotAPI(__name__, 'token') as app:
    app.send_message('chat-id', 'Hey!')
```

### Handler the Bot API
```python
from rb import BotAPI

with BotAPI(__name__, 'token') as app:
    app.add_event_handling((r'\w{1}start .+', 'Hello'))
    
    @app.handler
    def update(methods, update, event):
        ...
```


_____________________________

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.


Updates - 🌀 :
--------
    - Complete documentation and optimization.

___________________________


## INSTALLING
```bash
pip install rubx
```


## UPGRADE
```
pip install rubx --upgrade
```


# self rubika client with python3 RUBX module ![](https://i.imgur.com/fe85aVR.png)

_______________________

[![Python 3|2.7|3.x](https://img.shields.io/badge/python-3|3.0|3.x-yellow.svg)](https://www.python.org/)

[![License](https://img.shields.io/badge/license-GPLv2-red.svg)](https://raw.githubusercontent.com/Mester-Root/rubx/main/LICENSE)

[![Creator](https://img.shields.io/badge/Telegram-Channel-33A8E3)](https://t.me/rubx_library)

[![Telegram](https://img.shields.io/badge/-telegram-red?color=white&logo=telegram&logoColor=black)](https://t.me/clientUser)
_______________________

<div align="center">

![issues](https://img.shields.io/github/issues/mester-root/rubx)
![forks](https://img.shields.io/github/forks/mester-root/rubx)
![version](https://img.shields.io/badge/version-v--1.0.1--beta-yellow)
![stars](https://img.shields.io/github/stars/mester-root/rubx)
![license](https://img.shields.io/github/license/mester-root/rubx)
![icon](https://raw.githubusercontent.com/Mester-Root/rubx/main/logo.png)
</div>


_______________________


### **special**:

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mester-root/rubx",
    "name": "rubx",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "~=3.9",
    "maintainer_email": "",
    "keywords": "messenger,python,self,rubx,rubix,rubikax,rubika,bot,robot,library,rubikalib,rubikalibrary,rubika.ir,web.rubika.ir,telegram",
    "author": "Saleh",
    "author_email": "m3st3r.r00t@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8f/37/824ee6aa941baef6c56ae428a223326e226c3db49598df6c01d25c1428f8/rubx-10.6.9.tar.gz",
    "platform": null,
    "description": "\r\n<p align=\"center\">\r\n    <a href=\"https://github.com/mester-root/rubx\">\r\n        <img src=\"https://raw.githubusercontent.com/Mester-Root/rubx/main/icons/rubx-action.png\" alt=\"RuBx\" width=\"420\">\r\n    </a>\r\n    <br>\r\n    <b>Rubika Client API Framework | Python 3</b>\r\n    <br>\r\n    <a href=\"https://github.com/Mester-Root/rubx/blob/main/README.md\">\r\n        Document\r\n    </a>\r\n     \u2022\r\n    <a href=\"https://t.me/rubx_library\">\r\n        Telegram\r\n    </a>\r\n     \u2022\r\n    <a href=\"https://rubika.ir/TheClient\">\r\n        Rubika\r\n    </a>\r\n</p>\r\n\r\n\r\n# Rubx | Rubika Client \r\n\r\n## Messenger Methods:\r\n\r\n```python\r\n\r\nfrom rb import RubikaClient # rb: is main package\r\n\r\nwith RubikaClient('session', platform='rubx',) as client: # set the proxy, api client, api version, ...\r\n   client.send_message('Hey There!', 'username') # username, chat id, prviate links\r\n\r\n```\r\n\r\n### Or\r\n\r\n```python\r\nfrom rb import RubikaClient\r\n\r\ndef respond(callable, params) -> dict:\r\n    return callable(**params)\r\n\r\nwith RubikaClient(...) as client:\r\n    print(\r\n        respond(\r\n            client.send_message,\r\n            dict(\r\n                chat_id=...,\r\n                text='**Hey** @User@  __My__ ``Friend`` ~~How r u?~~'\r\n                mention_user_ids=['u0...']),\r\n            )\r\n        )\r\n\r\n    # for emoji\r\n    # print(respond(client.send_message, dict(chat_id=..., sticker=True, emoji_character='\ud83d\ude1c', sticker_id=..., )))\r\n```\r\n\r\n### Or\r\n\r\n```python\r\n# shorcuts\r\n\r\nfrom rb import RubikaClient\r\nfrom rb.responses import Self\r\n\r\nwith RubikaClient(...) as client:\r\n    print(client == Self.Text(text='Hey', chat_id='chat-guid')) # to send a message\r\n    \r\n    # print(client * 'chat-guid') # to get chat info\r\n    # print(client['chat-guid']) # to get a message from chat\r\n    # client['send_message'] = dict(text='Hey there', chat_id='chat-guid') # example to usage methods with setitem\r\n    # use the all operators\r\n\r\n```\r\n\r\n### if you forget the method name\r\n```python\r\nfrom rb import RubikaClient\r\n\r\nwith RubikaClient('session') as client:\r\n    print(client.getChatInfo(client, 'chat-guid')) # GetChatInfo, GETchatINFO, or ...\r\n    # normally: client.get_chat_info('chat-guid')\r\n```\r\n\r\n\r\n## Rubino Methods:\r\n\r\n``` python\r\n\r\nfrom rb import RubinoClient\r\n\r\nwith RubinoClient('session') as app:\r\n    app.create_page(...)\r\n\r\n```\r\n\r\n## Handler Methods:\r\n\r\n### Handler Examples\r\n\r\n```python\r\nfrom rb import Handler, EventBuilder, Filters\r\n\r\nclient = Handler(...)\r\n\r\n# handlers: HandShake, ChatsUpdates, MessagesUpdates\r\nclient.add_event_handling(func='ChatsUpdates', events=dict(get_chats=True, get_messages=True, pattern=('/start', 'Hey from rubx lib.')))\r\n\r\n@client.handler\r\ndef hello(app, message: EventBuilder, event):\r\n    # to print message: print(message) or print(event)\r\n    # to use all methods: app.create_objcet_voice_chat(...)\r\n    message.respond(message.pattern, Filters.author) # filters: chat, group, channel, author\r\n```\r\n\r\n### Or\r\n\r\n```python\r\nfrom rb import Handler, Filters, Performers\r\n\r\nclient = Handler('session')\r\n\r\ndef event(message):\r\n    message.respond(message.pattern, Filters.author)\r\n        \r\nclient.add_event_handling(func=Performers.hand_shake, events=dict(get_chats=True, get_messages=True, pattern=('/start', 'Hi from rubx lib.')))\r\nclient.starting = True\r\nclient.command_handler(event)\r\n```\r\n\r\n## To using HandShake(WebSocket):\r\n\r\n```python\r\nfrom rb import Handler, EventBuilder, Filters, Performers\r\n\r\nclient = Handler('abc...', 'u0...')\r\nclient.add_event_handling(func=Performers.hand_shake, events=dict(get_messages=True, get_chats=False))\r\n@client.handler\r\ndef update(app, update, event):\r\n    if update.message.text == '/start':\r\n        message.reply(text='Hello my dear', chat_id=update.message.author_object_guid, reply_to_message_id=update.message.message_id)\r\n        # or using repond: message.respond('Hey!', Filters.author)\r\n```\r\n\r\n## Async Methods:\r\n\r\n```python\r\nfrom rb import Client # Client: asycn reader\r\n\r\nasync def run(*args):\r\n    async with Client(...) as client:\r\n        result = await client.start(client.send_message, 'Hey! from rubx', 'chat-guid')\r\n        print(result)\r\n\r\nClient.run(run)\r\n```\r\n\r\n\r\n## Bot API Methods:\r\n\r\n### example for api methods send message text\r\n```python\r\nfrom rb import BotAPI\r\n\r\nwith BotAPI(__name__, 'token') as app:\r\n    app.send_message('chat-id', 'Hey!')\r\n```\r\n\r\n### Handler the Bot API\r\n```python\r\nfrom rb import BotAPI\r\n\r\nwith BotAPI(__name__, 'token') as app:\r\n    app.add_event_handling((r'\\w{1}start .+', 'Hello'))\r\n    \r\n    @app.handler\r\n    def update(methods, update, event):\r\n        ...\r\n```\r\n\r\n\r\n_____________________________\r\n\r\nRubx - \u26a1\r\n========\r\n\r\n  - Now the best \u200d`sync\u200d` and `asycn` library for Rubika's was developed\r\n  - \u2b50\ufe0f Thanks **everyone** who has starred the project, it means a lot!\r\n\r\n**Rubx** is an sync **Python 3** rubika library to interact with Rubika's API\r\nas a user or through a bot account (self API alternative).\r\n\r\n    \ud83d\udd34 If you have code using Rubx before its 8.0.5 version, you must\r\n    read docs to learn how to migrate. \ud83d\udca1\r\n\r\nWhat is this?\r\n-------------\r\n\r\n\ud83c\uddee\ud83c\uddf7 - Rubika is a popular messaging application. This library is meant\r\nto make it easy for you to write Python programs that can interact\r\nwith Rubika. Think of it as a wrapper that has already done the\r\nheavy job for you, so you can focus on developing an application.\r\nThis module provides all the desired methods with a very simple and beautiful user interface and has a very high speed.\r\nGive your employer the best experience of a project.\r\n\r\n\r\nUpdates - \ud83c\udf00 :\r\n--------\r\n    - Complete documentation and optimization.\r\n\r\n___________________________\r\n\r\n\r\n## INSTALLING\r\n```bash\r\npip install rubx\r\n```\r\n\r\n\r\n## UPGRADE\r\n```\r\npip install rubx --upgrade\r\n```\r\n\r\n\r\n# self rubika client with python3 RUBX module ![](https://i.imgur.com/fe85aVR.png)\r\n\r\n_______________________\r\n\r\n[![Python 3|2.7|3.x](https://img.shields.io/badge/python-3|3.0|3.x-yellow.svg)](https://www.python.org/)\r\n\r\n[![License](https://img.shields.io/badge/license-GPLv2-red.svg)](https://raw.githubusercontent.com/Mester-Root/rubx/main/LICENSE)\r\n\r\n[![Creator](https://img.shields.io/badge/Telegram-Channel-33A8E3)](https://t.me/rubx_library)\r\n\r\n[![Telegram](https://img.shields.io/badge/-telegram-red?color=white&logo=telegram&logoColor=black)](https://t.me/clientUser)\r\n_______________________\r\n\r\n<div align=\"center\">\r\n\r\n![issues](https://img.shields.io/github/issues/mester-root/rubx)\r\n![forks](https://img.shields.io/github/forks/mester-root/rubx)\r\n![version](https://img.shields.io/badge/version-v--1.0.1--beta-yellow)\r\n![stars](https://img.shields.io/github/stars/mester-root/rubx)\r\n![license](https://img.shields.io/github/license/mester-root/rubx)\r\n![icon](https://raw.githubusercontent.com/Mester-Root/rubx/main/logo.png)\r\n</div>\r\n\r\n\r\n_______________________\r\n\r\n\r\n### **special**:\r\n\r\n- *[RUBX] > a library 'official' for rubika messnger with client server.*\r\n- *[RUBX] > use api's rubika, and full methods.*\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Iranian rubx library - rubika client module",
    "version": "10.6.9",
    "project_urls": {
        "Channel": "https://t.me/rubx_library",
        "Documentation": "https://github.com/Mester-Root/rubx/blob/main/README.md",
        "Download": "https://github.com/mester-root/rubx/releases/latest",
        "Homepage": "https://github.com/mester-root/rubx",
        "Source": "https://github.com/mester-root/rubx",
        "Tracker": "https://github.com/mester-root/rubx/issues"
    },
    "split_keywords": [
        "messenger",
        "python",
        "self",
        "rubx",
        "rubix",
        "rubikax",
        "rubika",
        "bot",
        "robot",
        "library",
        "rubikalib",
        "rubikalibrary",
        "rubika.ir",
        "web.rubika.ir",
        "telegram"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee8cf156ea4814b71504d29e78a17d454e01a321aac0975827a4e19cecd09990",
                "md5": "115c381cc4acb6a2b7917af12d670b1b",
                "sha256": "7530b97c1c72d8656d0c73b2cb7c2160659384e7d478682adc5ad911655689d4"
            },
            "downloads": -1,
            "filename": "rubx-10.6.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "115c381cc4acb6a2b7917af12d670b1b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.9",
            "size": 74479,
            "upload_time": "2023-05-08T13:15:01",
            "upload_time_iso_8601": "2023-05-08T13:15:01.922719Z",
            "url": "https://files.pythonhosted.org/packages/ee/8c/f156ea4814b71504d29e78a17d454e01a321aac0975827a4e19cecd09990/rubx-10.6.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8f37824ee6aa941baef6c56ae428a223326e226c3db49598df6c01d25c1428f8",
                "md5": "7908782af8f6143f5ce8742882ba388c",
                "sha256": "3641ede162d554baeadde90db56d4509eb3afbbb12b6aaa06da75c096d7e32d8"
            },
            "downloads": -1,
            "filename": "rubx-10.6.9.tar.gz",
            "has_sig": false,
            "md5_digest": "7908782af8f6143f5ce8742882ba388c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.9",
            "size": 69353,
            "upload_time": "2023-05-08T13:15:04",
            "upload_time_iso_8601": "2023-05-08T13:15:04.696988Z",
            "url": "https://files.pythonhosted.org/packages/8f/37/824ee6aa941baef6c56ae428a223326e226c3db49598df6c01d25c1428f8/rubx-10.6.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-08 13:15:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mester-root",
    "github_project": "rubx",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rubx"
}
        
Elapsed time: 0.08586s