RubigramClient 1.6.9__tar.gz → 1.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of RubigramClient might be problematic. Click here for more details.
- rubigramclient-1.7.0/LICENSE +21 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/PKG-INFO +53 -3
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/README.md +31 -1
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/RubigramClient.egg-info/PKG-INFO +53 -3
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/RubigramClient.egg-info/requires.txt +0 -1
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/pyproject.toml +2 -3
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/client.py +37 -1
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/filters.py +8 -6
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/method.py +5 -5
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/network.py +1 -1
- rubigramclient-1.7.0/rubigram/rubino/client.py +480 -0
- rubigramclient-1.7.0/rubigram/types.py +538 -0
- rubigramclient-1.6.9/LICENSE +0 -0
- rubigramclient-1.6.9/rubigram/rubino/client.py +0 -82
- rubigramclient-1.6.9/rubigram/types.py +0 -979
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/RubigramClient.egg-info/SOURCES.txt +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/RubigramClient.egg-info/dependency_links.txt +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/RubigramClient.egg-info/top_level.txt +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/__init__.py +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/enums.py +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/rubino/__init__.py +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/rubigram/state.py +0 -0
- {rubigramclient-1.6.9 → rubigramclient-1.7.0}/setup.cfg +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Javad
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
5
|
Author-email: Javad RZ <MrJavad.Email@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Javad
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
6
27
|
Classifier: Programming Language :: Python :: 3
|
|
7
28
|
Classifier: License :: OSI Approved :: MIT License
|
|
8
29
|
Classifier: Operating System :: OS Independent
|
|
@@ -11,9 +32,11 @@ Description-Content-Type: text/markdown
|
|
|
11
32
|
License-File: LICENSE
|
|
12
33
|
Requires-Dist: aiohttp
|
|
13
34
|
Requires-Dist: aiofiles
|
|
14
|
-
Requires-Dist: pydantic
|
|
15
35
|
Dynamic: license-file
|
|
16
36
|
|
|
37
|
+
<img src="http://rubigram.ir/Rubigram.jpg" alt="Rubigram Logo" width="200"/>
|
|
38
|
+
|
|
39
|
+
|
|
17
40
|
# Rubigram
|
|
18
41
|
A lightweight Python library to build Rubika bots easily.
|
|
19
42
|
|
|
@@ -22,7 +45,20 @@ A lightweight Python library to build Rubika bots easily.
|
|
|
22
45
|
pip install RubigramClient
|
|
23
46
|
```
|
|
24
47
|
|
|
25
|
-
##
|
|
48
|
+
## Quick Example
|
|
49
|
+
```python
|
|
50
|
+
from rubigram import Client
|
|
51
|
+
|
|
52
|
+
bot = Client(token="YOUR_TOKEN")
|
|
53
|
+
|
|
54
|
+
@bot.on_message()
|
|
55
|
+
async def echo(client, message):
|
|
56
|
+
await message.reply("Hello Rubigram!")
|
|
57
|
+
|
|
58
|
+
bot.run()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Reply and Edit message
|
|
26
62
|
```python
|
|
27
63
|
from rubigram import Client, filters
|
|
28
64
|
from rubigram.types import Update
|
|
@@ -104,3 +140,17 @@ async def main():
|
|
|
104
140
|
|
|
105
141
|
asyncio.run(main())
|
|
106
142
|
```
|
|
143
|
+
|
|
144
|
+
## Rubino
|
|
145
|
+
```python
|
|
146
|
+
from rubigram.rubino import Rubino
|
|
147
|
+
import asyncio
|
|
148
|
+
|
|
149
|
+
async def main():
|
|
150
|
+
auth = "YOUR_AUTH_ACCOUNT"
|
|
151
|
+
async with Rubino(auth) as app:
|
|
152
|
+
info = await app.get_my_profile_info()
|
|
153
|
+
print(info)
|
|
154
|
+
|
|
155
|
+
asyncio.run(main())
|
|
156
|
+
```
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
<img src="http://rubigram.ir/Rubigram.jpg" alt="Rubigram Logo" width="200"/>
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
# Rubigram
|
|
2
5
|
A lightweight Python library to build Rubika bots easily.
|
|
3
6
|
|
|
@@ -6,7 +9,20 @@ A lightweight Python library to build Rubika bots easily.
|
|
|
6
9
|
pip install RubigramClient
|
|
7
10
|
```
|
|
8
11
|
|
|
9
|
-
##
|
|
12
|
+
## Quick Example
|
|
13
|
+
```python
|
|
14
|
+
from rubigram import Client
|
|
15
|
+
|
|
16
|
+
bot = Client(token="YOUR_TOKEN")
|
|
17
|
+
|
|
18
|
+
@bot.on_message()
|
|
19
|
+
async def echo(client, message):
|
|
20
|
+
await message.reply("Hello Rubigram!")
|
|
21
|
+
|
|
22
|
+
bot.run()
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Reply and Edit message
|
|
10
26
|
```python
|
|
11
27
|
from rubigram import Client, filters
|
|
12
28
|
from rubigram.types import Update
|
|
@@ -86,5 +102,19 @@ async def main():
|
|
|
86
102
|
get_me = await bot.get_me()
|
|
87
103
|
print(get_me.asjson())
|
|
88
104
|
|
|
105
|
+
asyncio.run(main())
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Rubino
|
|
109
|
+
```python
|
|
110
|
+
from rubigram.rubino import Rubino
|
|
111
|
+
import asyncio
|
|
112
|
+
|
|
113
|
+
async def main():
|
|
114
|
+
auth = "YOUR_AUTH_ACCOUNT"
|
|
115
|
+
async with Rubino(auth) as app:
|
|
116
|
+
info = await app.get_my_profile_info()
|
|
117
|
+
print(info)
|
|
118
|
+
|
|
89
119
|
asyncio.run(main())
|
|
90
120
|
```
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
5
|
Author-email: Javad RZ <MrJavad.Email@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Javad
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
6
27
|
Classifier: Programming Language :: Python :: 3
|
|
7
28
|
Classifier: License :: OSI Approved :: MIT License
|
|
8
29
|
Classifier: Operating System :: OS Independent
|
|
@@ -11,9 +32,11 @@ Description-Content-Type: text/markdown
|
|
|
11
32
|
License-File: LICENSE
|
|
12
33
|
Requires-Dist: aiohttp
|
|
13
34
|
Requires-Dist: aiofiles
|
|
14
|
-
Requires-Dist: pydantic
|
|
15
35
|
Dynamic: license-file
|
|
16
36
|
|
|
37
|
+
<img src="http://rubigram.ir/Rubigram.jpg" alt="Rubigram Logo" width="200"/>
|
|
38
|
+
|
|
39
|
+
|
|
17
40
|
# Rubigram
|
|
18
41
|
A lightweight Python library to build Rubika bots easily.
|
|
19
42
|
|
|
@@ -22,7 +45,20 @@ A lightweight Python library to build Rubika bots easily.
|
|
|
22
45
|
pip install RubigramClient
|
|
23
46
|
```
|
|
24
47
|
|
|
25
|
-
##
|
|
48
|
+
## Quick Example
|
|
49
|
+
```python
|
|
50
|
+
from rubigram import Client
|
|
51
|
+
|
|
52
|
+
bot = Client(token="YOUR_TOKEN")
|
|
53
|
+
|
|
54
|
+
@bot.on_message()
|
|
55
|
+
async def echo(client, message):
|
|
56
|
+
await message.reply("Hello Rubigram!")
|
|
57
|
+
|
|
58
|
+
bot.run()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Reply and Edit message
|
|
26
62
|
```python
|
|
27
63
|
from rubigram import Client, filters
|
|
28
64
|
from rubigram.types import Update
|
|
@@ -104,3 +140,17 @@ async def main():
|
|
|
104
140
|
|
|
105
141
|
asyncio.run(main())
|
|
106
142
|
```
|
|
143
|
+
|
|
144
|
+
## Rubino
|
|
145
|
+
```python
|
|
146
|
+
from rubigram.rubino import Rubino
|
|
147
|
+
import asyncio
|
|
148
|
+
|
|
149
|
+
async def main():
|
|
150
|
+
auth = "YOUR_AUTH_ACCOUNT"
|
|
151
|
+
async with Rubino(auth) as app:
|
|
152
|
+
info = await app.get_my_profile_info()
|
|
153
|
+
print(info)
|
|
154
|
+
|
|
155
|
+
asyncio.run(main())
|
|
156
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "RubigramClient"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.7.0"
|
|
4
4
|
description = "A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.7"
|
|
@@ -15,6 +15,5 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
17
|
"aiohttp",
|
|
18
|
-
"aiofiles"
|
|
19
|
-
"pydantic"
|
|
18
|
+
"aiofiles"
|
|
20
19
|
]
|
|
@@ -36,6 +36,8 @@ class Client(Method):
|
|
|
36
36
|
self.ROUTES = []
|
|
37
37
|
self.MESSAGE_HANDLER = []
|
|
38
38
|
self.INLINE_HANDLER = []
|
|
39
|
+
self.EDIT_HANDLER = []
|
|
40
|
+
self.DELETE_HANDLER = []
|
|
39
41
|
self.state = StateManager()
|
|
40
42
|
super().__init__(token)
|
|
41
43
|
|
|
@@ -61,6 +63,28 @@ class Client(Method):
|
|
|
61
63
|
self.INLINE_HANDLER.append(wrapper)
|
|
62
64
|
return func
|
|
63
65
|
return decorator
|
|
66
|
+
|
|
67
|
+
def on_edit_message(self, filters: Optional[Filter] = None):
|
|
68
|
+
def decorator(func: Callable) -> Callable:
|
|
69
|
+
async def wrapper(client: Client, update: Update):
|
|
70
|
+
if filters is None or await filters(update):
|
|
71
|
+
await func(client, update)
|
|
72
|
+
return True
|
|
73
|
+
return False
|
|
74
|
+
self.EDIT_HANDLER.append(wrapper)
|
|
75
|
+
return func
|
|
76
|
+
return decorator
|
|
77
|
+
|
|
78
|
+
def on_delete_message(self, filters: Optional[Filter] = None):
|
|
79
|
+
def decorator(func: Callable) -> Callable:
|
|
80
|
+
async def wrapper(client: Client, update: Update):
|
|
81
|
+
if filters is None or await filters(update):
|
|
82
|
+
await func(client, update)
|
|
83
|
+
return True
|
|
84
|
+
return False
|
|
85
|
+
self.DELETE_HANDLER.append(wrapper)
|
|
86
|
+
return func
|
|
87
|
+
return decorator
|
|
64
88
|
|
|
65
89
|
def on_create_app(self, path: str, method: str = "GET"):
|
|
66
90
|
def decorator(func):
|
|
@@ -69,7 +93,19 @@ class Client(Method):
|
|
|
69
93
|
return decorator
|
|
70
94
|
|
|
71
95
|
async def dispatch(self, update: Union[Update, InlineMessage]):
|
|
72
|
-
|
|
96
|
+
if isinstance(update, InlineMessage):
|
|
97
|
+
handlers = self.INLINE_HANDLER
|
|
98
|
+
else:
|
|
99
|
+
type = update.type
|
|
100
|
+
if type == "NewMessage":
|
|
101
|
+
handlers = self.MESSAGE_HANDLER
|
|
102
|
+
elif type == "UpdatedMessage":
|
|
103
|
+
handlers = self.EDIT_HANDLER
|
|
104
|
+
elif type == "RemovedMessage":
|
|
105
|
+
handlers = self.DELETE_HANDLER
|
|
106
|
+
else:
|
|
107
|
+
logging.warning("Update type invalid : {}".format(type))
|
|
108
|
+
|
|
73
109
|
for handler in handlers:
|
|
74
110
|
matched = await handler(self, update)
|
|
75
111
|
if matched:
|
|
@@ -25,7 +25,7 @@ class Filter:
|
|
|
25
25
|
|
|
26
26
|
async def TEXT(message: Update):
|
|
27
27
|
if isinstance(message, Update):
|
|
28
|
-
return True if message.new_message and message.new_message.text else False
|
|
28
|
+
return True if message.new_message and message.new_message.text or message.updated_message.text else False
|
|
29
29
|
return False
|
|
30
30
|
|
|
31
31
|
async def FILE(message: Update):
|
|
@@ -126,8 +126,12 @@ class command(Filter):
|
|
|
126
126
|
super().__init__(self.filter)
|
|
127
127
|
|
|
128
128
|
async def filter(self, update: Update):
|
|
129
|
-
if isinstance(update, Update)
|
|
130
|
-
|
|
129
|
+
if isinstance(update, Update):
|
|
130
|
+
if update.new_message:
|
|
131
|
+
text = update.new_message.text
|
|
132
|
+
elif update.updated_message:
|
|
133
|
+
text = update.updated_message.text
|
|
134
|
+
else: return False
|
|
131
135
|
text = text if self.case_sensitive else text.lower()
|
|
132
136
|
return any(text.startswith(cmd) for cmd in self.cmds)
|
|
133
137
|
return False
|
|
@@ -163,9 +167,7 @@ class regex(Filter):
|
|
|
163
167
|
elif isinstance(update, InlineMessage):
|
|
164
168
|
text = getattr(update, "text", "")
|
|
165
169
|
|
|
166
|
-
if text
|
|
167
|
-
return bool(re.search(self.pattern, text))
|
|
168
|
-
return False
|
|
170
|
+
return bool(re.search(self.pattern, text)) if text else False
|
|
169
171
|
|
|
170
172
|
|
|
171
173
|
class chat(Filter):
|
|
@@ -36,19 +36,19 @@ class Method(Network):
|
|
|
36
36
|
return response
|
|
37
37
|
|
|
38
38
|
async def delete_message(self, chat_id: str, message_id: str):
|
|
39
|
-
await self.request("deleteMessage", {"chat_id": chat_id, "message_id": message_id})
|
|
39
|
+
return await self.request("deleteMessage", {"chat_id": chat_id, "message_id": message_id})
|
|
40
40
|
|
|
41
41
|
async def remove_chat_keypad(self, chat_id: str):
|
|
42
|
-
await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "Remove"})
|
|
42
|
+
return await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "Remove"})
|
|
43
43
|
|
|
44
44
|
async def edit_chat_keypad(self, chat_id: str, chat_keypad: Keypad):
|
|
45
|
-
await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "New", "chat_keypad": chat_keypad.asdict()})
|
|
45
|
+
return await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "New", "chat_keypad": chat_keypad.asdict()})
|
|
46
46
|
|
|
47
47
|
async def edit_message_keypad(self, chat_id: str, message_id: str, inline_keypad: Keypad):
|
|
48
|
-
await self.request("editMessageKeypad", {"chat_id": chat_id, "message_id": message_id, "inline_keypad": inline_keypad.asdict()})
|
|
48
|
+
return await self.request("editMessageKeypad", {"chat_id": chat_id, "message_id": message_id, "inline_keypad": inline_keypad.asdict()})
|
|
49
49
|
|
|
50
50
|
async def edit_message_text(self, chat_id: str, message_id: str, text: str):
|
|
51
|
-
await self.request("editMessageText", {"chat_id": chat_id, "message_id": message_id, "text": text})
|
|
51
|
+
return await self.request("editMessageText", {"chat_id": chat_id, "message_id": message_id, "text": text})
|
|
52
52
|
|
|
53
53
|
async def edit_message(
|
|
54
54
|
self,
|
|
@@ -33,7 +33,7 @@ class Network:
|
|
|
33
33
|
async with self.session.post(self.api + method, json=json) as response:
|
|
34
34
|
response.raise_for_status()
|
|
35
35
|
data: dict = await response.json()
|
|
36
|
-
return data.get("data")
|
|
36
|
+
return data.get("data", {})
|
|
37
37
|
|
|
38
38
|
async def getBytes(self, url: str) -> bytes:
|
|
39
39
|
await self.start()
|