RubigramClient 1.6.7__py3-none-any.whl → 1.6.9__py3-none-any.whl
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.
- rubigram/__init__.py +1 -0
- rubigram/enums.py +7 -1
- rubigram/filters.py +1 -1
- rubigram/method.py +97 -1
- rubigram/network.py +1 -1
- rubigram/rubino/__init__.py +1 -0
- rubigram/rubino/client.py +82 -0
- rubigram/types.py +15 -4
- {rubigramclient-1.6.7.dist-info → rubigramclient-1.6.9.dist-info}/METADATA +1 -1
- rubigramclient-1.6.9.dist-info/RECORD +15 -0
- rubigramclient-1.6.7.dist-info/RECORD +0 -13
- {rubigramclient-1.6.7.dist-info → rubigramclient-1.6.9.dist-info}/WHEEL +0 -0
- {rubigramclient-1.6.7.dist-info → rubigramclient-1.6.9.dist-info}/licenses/LICENSE +0 -0
- {rubigramclient-1.6.7.dist-info → rubigramclient-1.6.9.dist-info}/top_level.txt +0 -0
rubigram/__init__.py
CHANGED
rubigram/enums.py
CHANGED
rubigram/filters.py
CHANGED
|
@@ -143,7 +143,7 @@ class button(Filter):
|
|
|
143
143
|
|
|
144
144
|
async def filter(self, update: InlineMessage):
|
|
145
145
|
if isinstance(update, InlineMessage):
|
|
146
|
-
text = update.
|
|
146
|
+
text = update.aux_data.button_id or ""
|
|
147
147
|
text = text if self.case_sensitive else text.lower()
|
|
148
148
|
return any(text.startswith(btn) for btn in self.btn_ids)
|
|
149
149
|
return False
|
rubigram/method.py
CHANGED
|
@@ -49,6 +49,21 @@ class Method(Network):
|
|
|
49
49
|
|
|
50
50
|
async def edit_message_text(self, chat_id: str, message_id: str, text: str):
|
|
51
51
|
await self.request("editMessageText", {"chat_id": chat_id, "message_id": message_id, "text": text})
|
|
52
|
+
|
|
53
|
+
async def edit_message(
|
|
54
|
+
self,
|
|
55
|
+
chat_id: str,
|
|
56
|
+
message_id: str,
|
|
57
|
+
text: Optional[str] = None,
|
|
58
|
+
chat_keypad: Optional[Keypad] = None,
|
|
59
|
+
inline_keypad: Optional[Keypad] = None
|
|
60
|
+
):
|
|
61
|
+
if text:
|
|
62
|
+
await self.edit_message_text(chat_id, message_id, text)
|
|
63
|
+
if chat_keypad:
|
|
64
|
+
await self.edit_chat_keypad(chat_id, chat_keypad)
|
|
65
|
+
if inline_keypad:
|
|
66
|
+
await self.edit_message_keypad(chat_id, message_id, inline_keypad)
|
|
52
67
|
|
|
53
68
|
async def forward_message(self, from_chat_id: str, message_id: str, to_chat_id: str, disable_notification: bool = False) -> "MessageId":
|
|
54
69
|
data = {"from_chat_id": from_chat_id, "message_id": message_id, "to_chat_id": to_chat_id, "disable_notification": disable_notification}
|
|
@@ -255,4 +270,85 @@ class Method(Network):
|
|
|
255
270
|
return await self.send_file(chat_id, music, caption, file_name, "Music", **kwargs)
|
|
256
271
|
|
|
257
272
|
async def send_voice(self, chat_id: str, voice: Union[str, bytes], caption: Optional[str] = None, file_name: Optional[str] = None, **kwargs):
|
|
258
|
-
return await self.send_file(chat_id, voice, caption, file_name, "Voice", **kwargs)
|
|
273
|
+
return await self.send_file(chat_id, voice, caption, file_name, "Voice", **kwargs)
|
|
274
|
+
|
|
275
|
+
# async def get_messages(self, chat_id: str, message_ids: Optional[list[str]] = None):
|
|
276
|
+
# return await self.request("getMessages", {"chat_id": chat_id, "message_ids": message_ids})
|
|
277
|
+
|
|
278
|
+
# async def get_bot_command(self):
|
|
279
|
+
# return await self.request("getBotCommands", {})
|
|
280
|
+
|
|
281
|
+
# async def send_chat_action(self, chat_id: str, action: enums.ChatAction):
|
|
282
|
+
# return await self.request("sendChatAction", {"chat_id": chat_id, "action": action})
|
|
283
|
+
|
|
284
|
+
# async def set_username(self, username: str):
|
|
285
|
+
# return await self.request("setUsername", {"username": username})
|
|
286
|
+
|
|
287
|
+
async def get_bot_name(self):
|
|
288
|
+
bot = await self.get_me()
|
|
289
|
+
return bot.bot_title
|
|
290
|
+
|
|
291
|
+
async def get_bot_id(self):
|
|
292
|
+
bot = await self.get_me()
|
|
293
|
+
return bot.bot_id
|
|
294
|
+
|
|
295
|
+
async def get_bot_username(self):
|
|
296
|
+
bot = await self.get_me()
|
|
297
|
+
return bot.username
|
|
298
|
+
|
|
299
|
+
async def get_bot_share_url(self):
|
|
300
|
+
bot = await self.get_me()
|
|
301
|
+
return bot.share_url
|
|
302
|
+
|
|
303
|
+
async def get_bot_descriptionl(self):
|
|
304
|
+
bot = await self.get_me()
|
|
305
|
+
return bot.description
|
|
306
|
+
|
|
307
|
+
async def get_bot_start_messagel(self):
|
|
308
|
+
bot = await self.get_me()
|
|
309
|
+
return bot.start_message
|
|
310
|
+
|
|
311
|
+
# async def pin_message(self):
|
|
312
|
+
# return
|
|
313
|
+
|
|
314
|
+
# async def unpin_message(self):
|
|
315
|
+
# return
|
|
316
|
+
|
|
317
|
+
# async def ban_chat_member(self):
|
|
318
|
+
# return
|
|
319
|
+
|
|
320
|
+
# async def unban_chat_member(self):
|
|
321
|
+
# return
|
|
322
|
+
|
|
323
|
+
# async def get_chat_member(self):
|
|
324
|
+
# return
|
|
325
|
+
|
|
326
|
+
# async def copy_message(self):
|
|
327
|
+
# return
|
|
328
|
+
|
|
329
|
+
# async def edit_message_caption(self):
|
|
330
|
+
# return
|
|
331
|
+
|
|
332
|
+
# async def get_chat_administrators(self):
|
|
333
|
+
# return
|
|
334
|
+
|
|
335
|
+
# async def get_chat_member_count(self):
|
|
336
|
+
# return
|
|
337
|
+
|
|
338
|
+
# async def join_chat(self):
|
|
339
|
+
# return
|
|
340
|
+
|
|
341
|
+
# async def leave_chat(self):
|
|
342
|
+
# return
|
|
343
|
+
|
|
344
|
+
# async def set_chat_description(self):
|
|
345
|
+
# return
|
|
346
|
+
|
|
347
|
+
# async def set_chat_photo(self):
|
|
348
|
+
# return
|
|
349
|
+
|
|
350
|
+
# async def set_chat_title(self):
|
|
351
|
+
# return
|
|
352
|
+
|
|
353
|
+
# async def unpin_all_message(self):
|
|
354
|
+
# return
|
rubigram/network.py
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import Rubino
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
from aiohttp import ClientSession
|
|
2
|
+
from typing import Literal, Optional, Union, Any
|
|
3
|
+
from random import randint
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Rubino:
|
|
7
|
+
def __init__(self, auth: str):
|
|
8
|
+
self.auth = auth
|
|
9
|
+
self.api = f"https://rubino{randint(1, 30)}.iranlms.ir"
|
|
10
|
+
self.client = {
|
|
11
|
+
"app_name": "Main",
|
|
12
|
+
"app_version": "3.0.2",
|
|
13
|
+
"lang_code": "fa",
|
|
14
|
+
"package": "app.rbmain.a",
|
|
15
|
+
"platform": "Android"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
async def reauest(self, method: str, data: dict[str, Any]):
|
|
20
|
+
json = {
|
|
21
|
+
"api_version": "0",
|
|
22
|
+
"auth": self.auth,
|
|
23
|
+
"client": self.client,
|
|
24
|
+
"data": data,
|
|
25
|
+
"method": method
|
|
26
|
+
}
|
|
27
|
+
async with ClientSession() as session:
|
|
28
|
+
async with session.post(self.api, json=json) as response:
|
|
29
|
+
response.raise_for_status()
|
|
30
|
+
return await response.json()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async def get_post_by_share_link(self, post_link: str):
|
|
34
|
+
return await self.reauest("getPostByShareLink", {"share_string": post_link.split("/")[-1]})
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def add_post_view_count(self, post_id: str, post_profile_id: str):
|
|
38
|
+
data = {"post_id": post_id, "post_profile_id": post_profile_id}
|
|
39
|
+
return await self.reauest("addPostViewCount", data)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async def add_view_story(self, story_profile_id: str, story_ids: Union[str, list[str]], profile_id: Optional[str] = None):
|
|
43
|
+
story_ids = story_ids if isinstance(story_ids, list) else [story_ids]
|
|
44
|
+
data = {"story_profile_id": story_profile_id, "story_ids": story_ids, "profile_id": profile_id}
|
|
45
|
+
return await self.reauest("addViewStory", data)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def is_exist_username(self, username: str):
|
|
49
|
+
username = username.replace("@", "")
|
|
50
|
+
return await self.reauest("isExistUsername", {"username": username})
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def create_page(self, username: str, name: str, bio: Optional[str] = None):
|
|
54
|
+
return await self.reauest("createPage", {"username": username, "name": name, "bio": bio})
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
async def add_comment(self, content: str, post_id: str, post_profile_id: str, profile_id: Optional[str] = None):
|
|
58
|
+
rnd = randint(100000, 999999999)
|
|
59
|
+
data = {"content": content, "post_id": post_id, "post_profile_id": post_profile_id, "profile_id": profile_id, "rnd": rnd}
|
|
60
|
+
return await self.reauest("addComment", data)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
async def request_follow(self, followee_id: str, f_type: Literal["Follow", "Unfollow"] = "Follow", profile_id: Optional[str] = None):
|
|
64
|
+
data = {"f_type": f_type, "followee_id": followee_id, "profile_id": profile_id}
|
|
65
|
+
return self.reauest("requestFollow", data)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
async def set_block_profile(self, block_id: str, action: Literal["Block", "Unblock"] = "Block", profile_id: Optional[str] = None):
|
|
69
|
+
data = {"block_id": block_id, "action": action, "profile_id": profile_id}
|
|
70
|
+
return self.reauest("setBlockProfile", data)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
async def get_comments(self, post_id: str, post_profile_id: str, limit: Optional[int] = 100, profile_id: Optional[str] = None):
|
|
74
|
+
data = {
|
|
75
|
+
"post_id": post_id,
|
|
76
|
+
"post_profile_id": post_profile_id,
|
|
77
|
+
"limit": limit,
|
|
78
|
+
"profile_id": profile_id,
|
|
79
|
+
"equal": False,
|
|
80
|
+
"sort": "FromMax"
|
|
81
|
+
}
|
|
82
|
+
return await self.reauest("getComments", data)
|
rubigram/types.py
CHANGED
|
@@ -54,13 +54,13 @@ class Chat(DataManager):
|
|
|
54
54
|
class File(DataManager):
|
|
55
55
|
file_id: Optional[str] = None
|
|
56
56
|
file_name: Optional[str] = None
|
|
57
|
-
size: Optional[
|
|
57
|
+
size: Optional[int] = None
|
|
58
58
|
|
|
59
59
|
def __init__(
|
|
60
60
|
self,
|
|
61
61
|
file_id: Optional[str] = None,
|
|
62
62
|
file_name: Optional[str] = None,
|
|
63
|
-
size: Optional[
|
|
63
|
+
size: Optional[int] = None,
|
|
64
64
|
**kwargs
|
|
65
65
|
):
|
|
66
66
|
super().__init__(
|
|
@@ -731,12 +731,23 @@ class MessageId(DataManager):
|
|
|
731
731
|
|
|
732
732
|
async def delete(self):
|
|
733
733
|
return await self.client.delete_message(self.chat_id, self.message_id)
|
|
734
|
+
|
|
735
|
+
async def edit(self, text: Optional[str] = None, inline: Optional[Keypad] = None, keypad: Optional[Keypad] = None):
|
|
736
|
+
if text:
|
|
737
|
+
await self.edit_text(text)
|
|
738
|
+
if inline:
|
|
739
|
+
await self.edit_inline(inline)
|
|
740
|
+
if keypad:
|
|
741
|
+
await self.edit_keypad(keypad)
|
|
734
742
|
|
|
735
743
|
async def edit_text(self, text: str):
|
|
736
744
|
return await self.client.edit_message_text(self.chat_id, self.message_id, text)
|
|
737
745
|
|
|
738
|
-
async def
|
|
739
|
-
return await self.client.edit_message_keypad(self.chat_id, self.message_id,
|
|
746
|
+
async def edit_inline(self, inline: Keypad):
|
|
747
|
+
return await self.client.edit_message_keypad(self.chat_id, self.message_id, inline)
|
|
748
|
+
|
|
749
|
+
async def edit_keypad(self, keypad: Keypad):
|
|
750
|
+
return await self.client.edit_chat_keypad(self.chat_id, keypad)
|
|
740
751
|
|
|
741
752
|
async def forward(self, chat_id: str):
|
|
742
753
|
return await self.client.forward_message(self.chat_id, self.message_id, chat_id)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.9
|
|
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
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
rubigram/__init__.py,sha256=yyPILotyVazCcf1qrKEu_67yYsvLGns2oJlSfLmvhd8,152
|
|
2
|
+
rubigram/client.py,sha256=Pg50Za2idur97ZgphmXgQvu0n0N63oPE04sqhujgNk0,5940
|
|
3
|
+
rubigram/enums.py,sha256=maI0tD9hQz6QUbjiAmBzMowfZbj1ao-6LqkYybSpbFY,2841
|
|
4
|
+
rubigram/filters.py,sha256=Al2LUNLS0hLg9F0BOdU6n1FRnyRLOYHUZFdYW5YEGCw,6852
|
|
5
|
+
rubigram/method.py,sha256=tXEyXYisIfW3sVvCJ65oX2UAc4el9d3qfZI7hVPbZto,14276
|
|
6
|
+
rubigram/network.py,sha256=Dx1j4PFMpFDF64zaxRWHzZymqq8GJgRNnUQJ2kfI6Vw,2854
|
|
7
|
+
rubigram/state.py,sha256=_g13o87MHfuudbgvbfu9vAOrSzw4GhdEYkD6dSn7t2s,997
|
|
8
|
+
rubigram/types.py,sha256=aSOQ04-b-jF1PuiRn3uEArfbxASSFhqlTovgJoC-3Ik,29760
|
|
9
|
+
rubigram/rubino/__init__.py,sha256=6-ztB6rLeIB3SV4tbVPPUxmNqHQUYQhDee6bnNQdECw,26
|
|
10
|
+
rubigram/rubino/client.py,sha256=3Z4lAItC0IKsp0vlRdUE_dhEw-IFolSZ2Aukg7Qeieg,3479
|
|
11
|
+
rubigramclient-1.6.9.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
rubigramclient-1.6.9.dist-info/METADATA,sha256=3XkWFjF8__lLbm8zbah54x2ZfpCrYaQmVUH73D8bXc0,2655
|
|
13
|
+
rubigramclient-1.6.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
rubigramclient-1.6.9.dist-info/top_level.txt,sha256=Mhg5HfkL6rLec5sI4ClGmwoqYUANAZUz8sVa1sT_cas,9
|
|
15
|
+
rubigramclient-1.6.9.dist-info/RECORD,,
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
rubigram/__init__.py,sha256=h2O7aVl3woDBTHX0MdZLbhgvVRTyXA0NTzOz7F8Y7Xg,124
|
|
2
|
-
rubigram/client.py,sha256=Pg50Za2idur97ZgphmXgQvu0n0N63oPE04sqhujgNk0,5940
|
|
3
|
-
rubigram/enums.py,sha256=UZKH1wROBVMuHVEjrnQSwpi-y2MxMI7zl2uThdPTWoc,2722
|
|
4
|
-
rubigram/filters.py,sha256=40znxAC7xAFYCeERlPYLSVtr0lxUcnQY2HRwt1zSfdk,6838
|
|
5
|
-
rubigram/method.py,sha256=T_JpN6pF-xjRaw__If48H-63tzjFM8VZaUCTqd4vL2I,11501
|
|
6
|
-
rubigram/network.py,sha256=v_JQpVMrHUwDk5oBXgjIBmLGYtyDxUPu7Qvqvk2XUy0,2862
|
|
7
|
-
rubigram/state.py,sha256=_g13o87MHfuudbgvbfu9vAOrSzw4GhdEYkD6dSn7t2s,997
|
|
8
|
-
rubigram/types.py,sha256=MrggHVI62icQpVhVASXI7UV5pav-HuHB6wwVzyg9P90,29326
|
|
9
|
-
rubigramclient-1.6.7.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
|
-
rubigramclient-1.6.7.dist-info/METADATA,sha256=RMfK7tSH7TDK1c2h5a_CocA5PVh5ogX8MPxZKtomGI4,2655
|
|
11
|
-
rubigramclient-1.6.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
-
rubigramclient-1.6.7.dist-info/top_level.txt,sha256=Mhg5HfkL6rLec5sI4ClGmwoqYUANAZUz8sVa1sT_cas,9
|
|
13
|
-
rubigramclient-1.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|