Rubka 7.1.7__py3-none-any.whl → 7.1.8__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.
- rubka/asynco.py +45 -0
- {rubka-7.1.7.dist-info → rubka-7.1.8.dist-info}/METADATA +1 -1
- {rubka-7.1.7.dist-info → rubka-7.1.8.dist-info}/RECORD +6 -6
- {rubka-7.1.7.dist-info → rubka-7.1.8.dist-info}/WHEEL +0 -0
- {rubka-7.1.7.dist-info → rubka-7.1.8.dist-info}/entry_points.txt +0 -0
- {rubka-7.1.7.dist-info → rubka-7.1.8.dist-info}/top_level.txt +0 -0
rubka/asynco.py
CHANGED
|
@@ -2171,6 +2171,51 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2171
2171
|
async def get_username(self, chat_id: str) -> str:
|
|
2172
2172
|
chat_info = await self.get_chat(chat_id)
|
|
2173
2173
|
return chat_info.get("data", {}).get("chat", {}).get("username", "None")
|
|
2174
|
+
async def send_bulk_message(
|
|
2175
|
+
self,
|
|
2176
|
+
chat_ids: List[str],
|
|
2177
|
+
text: str,
|
|
2178
|
+
concurrency: int = 5,
|
|
2179
|
+
delay_between: float = 0.0,
|
|
2180
|
+
log_errors: bool = True,
|
|
2181
|
+
**kwargs
|
|
2182
|
+
) -> Dict[str, Optional[Dict]]:
|
|
2183
|
+
if not chat_ids:return {}
|
|
2184
|
+
semaphore = asyncio.Semaphore(concurrency)
|
|
2185
|
+
results: Dict[str, Optional[Dict]] = {}
|
|
2186
|
+
async def _send(chat_id: str):
|
|
2187
|
+
async with semaphore:
|
|
2188
|
+
try:
|
|
2189
|
+
res = await self.send_message(chat_id, text, **kwargs)
|
|
2190
|
+
results[chat_id] = res
|
|
2191
|
+
except Exception as e:
|
|
2192
|
+
results[chat_id] = None
|
|
2193
|
+
if log_errors:print(f"[send_bulk_message] Error {chat_id} : {e}")
|
|
2194
|
+
if delay_between > 0:await asyncio.sleep(delay_between)
|
|
2195
|
+
await asyncio.gather(*[_send(cid) for cid in chat_ids])
|
|
2196
|
+
return results
|
|
2197
|
+
async def delete_bulk_message(self, chat_id: str, message_ids: list[str]):
|
|
2198
|
+
tasks = [self.delete_message(chat_id, mid) for mid in message_ids]
|
|
2199
|
+
return await asyncio.gather(*tasks, return_exceptions=True)
|
|
2200
|
+
async def edit_bulk_message(self, chat_id: str, messages: dict[str, str]):
|
|
2201
|
+
tasks = [self.edit_message_text(chat_id, mid, new_text) for mid, new_text in messages.items()]
|
|
2202
|
+
return await asyncio.gather(*tasks, return_exceptions=True)
|
|
2203
|
+
async def send_scheduled_message(self, chat_id: str, text: str, delay: int, **kwargs):
|
|
2204
|
+
await asyncio.sleep(delay)
|
|
2205
|
+
return await self.send_message(chat_id, text, **kwargs)
|
|
2206
|
+
async def disable_inline_keyboard(
|
|
2207
|
+
self,
|
|
2208
|
+
chat_id: str,
|
|
2209
|
+
message_id: str,
|
|
2210
|
+
text: Optional[str] = "~",
|
|
2211
|
+
delay: float = 5.0,
|
|
2212
|
+
) -> Dict[str, any]:
|
|
2213
|
+
if text is not None:await self.edit_inline_keypad(chat_id, message_id, inline_keypad={}, text=text)
|
|
2214
|
+
if delay > 0:
|
|
2215
|
+
await asyncio.sleep(delay)
|
|
2216
|
+
response = await self.edit_inline_keypad(chat_id, message_id, inline_keypad={})
|
|
2217
|
+
return response
|
|
2218
|
+
else:return await self.edit_inline_keypad(chat_id, message_id, inline_keypad={})
|
|
2174
2219
|
async def get_chat_admins(self, chat_id: str) -> Dict[str, Any]:
|
|
2175
2220
|
return await self._post("getChatAdmins", {"chat_id": chat_id})
|
|
2176
2221
|
async def get_chat_members(self, chat_id: str, start_id: str = "") -> Dict[str, Any]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Rubka
|
|
3
|
-
Version: 7.1.
|
|
3
|
+
Version: 7.1.8
|
|
4
4
|
Summary: Rubika: A Python library for interacting with the Rubika Bot API. This library provides an easy-to-use interface to send messages, polls, stickers, media files, manage groups and channels, handle inline keyboards, and implement advanced bot features like subscription management, user authentication, and message handling. Ideal for developers looking to automate and extend their Rubika bots with Python.
|
|
5
5
|
Home-page: https://github.com/Mahdy-Ahmadi/Rubka
|
|
6
6
|
Download-URL: https://github.com/Mahdy-Ahmadi/rubka/archive/refs/tags/v6.6.4.zip
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
rubka/__init__.py,sha256=P6IBiORfp-GqKHe5LZ-5lldWyG7tnrUYUcAQDUgwXmY,1973
|
|
2
2
|
rubka/api.py,sha256=wa1gQj7NDc7QEbmNNRz-TIOdVqfMWFC362tndRKdqig,68449
|
|
3
|
-
rubka/asynco.py,sha256=
|
|
3
|
+
rubka/asynco.py,sha256=uuqhWLPrhPVIlb4l7umwryYFD_x2tDFfcYxo-Yb49Uc,112784
|
|
4
4
|
rubka/button.py,sha256=woSzZVd5MtTqOrP-YgkH5b0GS9y4DuKBsFSc9-KuLnk,13320
|
|
5
5
|
rubka/config.py,sha256=Bck59xkOiqioLv0GkQ1qPGnBXVctz1hKk6LT4h2EPx0,78
|
|
6
6
|
rubka/context.py,sha256=OowmsvqkThzB1NDhK5629Jm4ExdaWcjUo4rsBjpTtjA,38536
|
|
@@ -37,8 +37,8 @@ rubka/adaptorrubka/types/socket/message.py,sha256=0WgLMZh4eow8Zn7AiSX4C3GZjQTkIg
|
|
|
37
37
|
rubka/adaptorrubka/utils/__init__.py,sha256=OgCFkXdNFh379quNwIVOAWY2NP5cIOxU5gDRRALTk4o,54
|
|
38
38
|
rubka/adaptorrubka/utils/configs.py,sha256=nMUEOJh1NqDJsf9W9PurkN_DLYjO6kKPMm923i4Jj_A,492
|
|
39
39
|
rubka/adaptorrubka/utils/utils.py,sha256=5-LioLNYX_TIbQGDeT50j7Sg9nAWH2LJUUs-iEXpsUY,8816
|
|
40
|
-
rubka-7.1.
|
|
41
|
-
rubka-7.1.
|
|
42
|
-
rubka-7.1.
|
|
43
|
-
rubka-7.1.
|
|
44
|
-
rubka-7.1.
|
|
40
|
+
rubka-7.1.8.dist-info/METADATA,sha256=IABsRdDfilIc89k98H66SE0qz9jfcNP6MGv8wBaHn5M,34667
|
|
41
|
+
rubka-7.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
42
|
+
rubka-7.1.8.dist-info/entry_points.txt,sha256=4aESuUmuUOALMUy7Kucv_Gb5YlqhsJmTmdXLlZU9sJ0,46
|
|
43
|
+
rubka-7.1.8.dist-info/top_level.txt,sha256=vy2A4lot11cRMdQS-F4HDCIXL3JK8RKfu7HMDkezJW4,6
|
|
44
|
+
rubka-7.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|