-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.py
338 lines (244 loc) · 9.5 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
#!/bin/python
from setuptools import find_packages, setup
requires = ['requests', 'urllib3', 'datetime']
version = '10.6.6'
readme = '''
<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 messenger
## Messenger:
```python
from rb import RubikaClient # rb: is main package
with RubikaClient('session') as client:
client.send_message('Hello From Rubx', '@username')
```
### Or
```python
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
```python
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
```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')
```
#### for show all operators and shortcuts go to docs
## Rubino
``` python
from rb import RubinoClient
with RubinoClient('session') as app:
app.create_page(...)
```
## Handler
### 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, 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
```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)
```
### How to get keys from result?
```python
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
```
## 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
```python
from rb import BotAPI
with BotAPI(__name__, 'token') as app:
app.add_event_handling(('\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.
Updating - 🌀 :
--------
- Complete documentation and optimization.
___________________________
## INSTALLING
```bash
pip install rubx
```
## UPGRADE
```
pip install rubx --upgrade
```
## CREATED BY:
- saleh
# 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.*
#### to use it, your python must support **type hint**.
'''
setup(
name="rubx",
version=version,
description="Rubx Library For Rubika Iranina Messenger",
long_description=readme,
long_description_content_type="text/markdown",
url="https://github.com/mester-root/rubx",
download_url="https://github.com/mester-root/rubx/releases/latest",
author="Saleh",
author_email="m3st3r.r00t@gmail.com",
license="MIT",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Internet",
"Topic :: Communications",
"Topic :: Communications :: Chat",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries :: Application Frameworks"
],
keywords=['messenger', 'python', 'self', 'rubx', 'rubix', 'rubikax', 'rubika', 'bot', 'robot', 'library', 'rubikalib', 'rubikalibrary', 'rubika.ir', 'web.rubika.ir', 'telegram'],
project_urls={
"Tracker": "https://github.com/mester-root/rubx/issues",
"Channel": "https://t.me/rubx_library",
"Source": "https://github.com/mester-root/rubx",
"Documentation": "https://github.com/Mester-Root/rubx/blob/main/README.md",
},
python_requires="~=3.9",
packages=find_packages(),
zip_safe=False,
install_requires=requires
)