Rubka 7.1.18__py3-none-any.whl → 7.2.1__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 +58 -39
- rubka/context.py +28 -2
- rubka/filters.py +4 -3
- {rubka-7.1.18.dist-info → rubka-7.2.1.dist-info}/METADATA +1 -1
- {rubka-7.1.18.dist-info → rubka-7.2.1.dist-info}/RECORD +8 -8
- {rubka-7.1.18.dist-info → rubka-7.2.1.dist-info}/WHEEL +0 -0
- {rubka-7.1.18.dist-info → rubka-7.2.1.dist-info}/entry_points.txt +0 -0
- {rubka-7.1.18.dist-info → rubka-7.2.1.dist-info}/top_level.txt +0 -0
rubka/asynco.py
CHANGED
|
@@ -280,6 +280,7 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
280
280
|
self.proxy = proxy
|
|
281
281
|
self.max_msg_age = max_msg_age
|
|
282
282
|
self.retries = retries
|
|
283
|
+
self.middleware_data = []
|
|
283
284
|
|
|
284
285
|
self.retry_delay = retry_delay
|
|
285
286
|
self.raise_errors = raise_errors
|
|
@@ -541,6 +542,11 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
541
542
|
|
|
542
543
|
#decorator#
|
|
543
544
|
|
|
545
|
+
def middleware(self):
|
|
546
|
+
def decorator(func: Callable[[Any, Union[Message, InlineMessage]], None]):
|
|
547
|
+
self.middleware_data.append(func)
|
|
548
|
+
return func
|
|
549
|
+
return decorator
|
|
544
550
|
def on_message_private(
|
|
545
551
|
self,
|
|
546
552
|
chat_id: Optional[Union[str, List[str]]] = None,
|
|
@@ -1842,20 +1848,23 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
1842
1848
|
reply_to_message_id: Optional[str] = None,
|
|
1843
1849
|
chat_keypad_type: Optional[Literal["New", "Remove"]] = None,
|
|
1844
1850
|
delete_after: Optional[int] = None,
|
|
1845
|
-
parse_mode: Optional[Literal["HTML", "Markdown"]] = None
|
|
1851
|
+
parse_mode: Optional[Literal["HTML", "Markdown"]] = None,
|
|
1852
|
+
meta_data:Optional[dict] = None
|
|
1846
1853
|
) -> Dict[str, Any]:
|
|
1847
|
-
|
|
1848
1854
|
payload = {
|
|
1849
1855
|
"chat_id": chat_id,
|
|
1850
1856
|
"text": text,
|
|
1851
1857
|
"disable_notification": disable_notification,
|
|
1852
1858
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
+
if not meta_data:
|
|
1860
|
+
parse_mode_to_use = parse_mode or self.parse_mode
|
|
1861
|
+
if text:
|
|
1862
|
+
text, metadata = self._parse_text_metadata(text, parse_mode_to_use)
|
|
1863
|
+
payload["text"] = text
|
|
1864
|
+
if metadata:
|
|
1865
|
+
payload["metadata"] = metadata
|
|
1866
|
+
else :
|
|
1867
|
+
payload["metadata"] = meta_data
|
|
1859
1868
|
if chat_keypad:
|
|
1860
1869
|
payload["chat_keypad"] = chat_keypad
|
|
1861
1870
|
payload["chat_keypad_type"] = chat_keypad_type or "New"
|
|
@@ -2142,16 +2151,20 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2142
2151
|
raise ValueError(f"Invalid media type. Must be one of {allowed}")
|
|
2143
2152
|
result = await self._post("requestSendFile", {"type": media_type})
|
|
2144
2153
|
return result.get("data", {}).get("upload_url")
|
|
2145
|
-
async def _send_uploaded_file(self, chat_id: str, file_id: str,type_file : str = "file",text: Optional[str] = None, chat_keypad: Optional[Dict[str, Any]] = None, inline_keypad: Optional[Dict[str, Any]] = None, disable_notification: bool = False, reply_to_message_id: Optional[str] = None, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2154
|
+
async def _send_uploaded_file(self, chat_id: str, file_id: str,type_file : str = "file",text: Optional[str] = None, chat_keypad: Optional[Dict[str, Any]] = None, inline_keypad: Optional[Dict[str, Any]] = None, disable_notification: bool = False, reply_to_message_id: Optional[str] = None, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2146
2155
|
payload = {"chat_id": chat_id, "file_id": file_id, "text": text, "disable_notification": disable_notification, "chat_keypad_type": chat_keypad_type}
|
|
2147
2156
|
if chat_keypad: payload["chat_keypad"] = chat_keypad
|
|
2148
2157
|
if inline_keypad: payload["inline_keypad"] = inline_keypad
|
|
2149
2158
|
if reply_to_message_id: payload["reply_to_message_id"] = str(reply_to_message_id)
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2159
|
+
if not meta_data:
|
|
2160
|
+
parse_mode_to_use = parse_mode or self.parse_mode
|
|
2161
|
+
if text:
|
|
2162
|
+
text, metadata = self._parse_text_metadata(text, parse_mode_to_use)
|
|
2163
|
+
payload["text"] = text
|
|
2164
|
+
if metadata:
|
|
2165
|
+
payload["metadata"] = metadata
|
|
2166
|
+
else :
|
|
2167
|
+
payload["metadata"] = meta_data
|
|
2155
2168
|
payload["time"] = "10"
|
|
2156
2169
|
resp = await self._post("sendFile", payload)
|
|
2157
2170
|
message_id_put = resp["data"]["message_id"]
|
|
@@ -2171,26 +2184,26 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2171
2184
|
"chat_keypad_type":chat_keypad_type
|
|
2172
2185
|
}
|
|
2173
2186
|
return AttrDict(result)
|
|
2174
|
-
async def _send_file_generic(self, media_type, chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode: Optional[Literal["HTML", "Markdown"]] = None):
|
|
2187
|
+
async def _send_file_generic(self, media_type, chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None):
|
|
2175
2188
|
if path:
|
|
2176
2189
|
file_name = file_name or Path(path).name
|
|
2177
2190
|
upload_url = await self.get_upload_url(media_type)
|
|
2178
2191
|
file_id = await self.upload_media_file(upload_url, file_name, path)
|
|
2179
2192
|
if not file_id:
|
|
2180
2193
|
raise ValueError("Either path or file_id must be provided.")
|
|
2181
|
-
return await self._send_uploaded_file(chat_id=chat_id, file_id=file_id, text=text, inline_keypad=inline_keypad, chat_keypad=chat_keypad, reply_to_message_id=reply_to_message_id, disable_notification=disable_notification, chat_keypad_type=chat_keypad_type,type_file=media_type,parse_mode=parse_mode)
|
|
2182
|
-
async def send_document(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2183
|
-
return await self._send_file_generic("File", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2184
|
-
async def send_file(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, caption: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2185
|
-
return await self._send_file_generic("File", chat_id, path, file_id, caption, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2186
|
-
async def re_send(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, caption: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2187
|
-
return await self._send_file_generic("File", chat_id, path, file_id, caption, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2188
|
-
async def send_video(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2189
|
-
return await self._send_file_generic("Video", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2190
|
-
async def send_voice(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2191
|
-
return await self._send_file_generic("voice", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2192
|
-
async def send_image(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2193
|
-
return await self._send_file_generic("Image", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode)
|
|
2194
|
+
return await self._send_uploaded_file(chat_id=chat_id, file_id=file_id, text=text, inline_keypad=inline_keypad, chat_keypad=chat_keypad, reply_to_message_id=reply_to_message_id, disable_notification=disable_notification, chat_keypad_type=chat_keypad_type,type_file=media_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2195
|
+
async def send_document(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2196
|
+
return await self._send_file_generic("File", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2197
|
+
async def send_file(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, caption: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2198
|
+
return await self._send_file_generic("File", chat_id, path, file_id, caption, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2199
|
+
async def re_send(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, caption: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2200
|
+
return await self._send_file_generic("File", chat_id, path, file_id, caption, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2201
|
+
async def send_video(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2202
|
+
return await self._send_file_generic("Video", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2203
|
+
async def send_voice(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2204
|
+
return await self._send_file_generic("voice", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2205
|
+
async def send_image(self, chat_id: str, path: Optional[Union[str, Path]] = None, file_id: Optional[str] = None, text: Optional[str] = None, file_name: Optional[str] = None, inline_keypad: Optional[Dict[str, Any]] = None, chat_keypad: Optional[Dict[str, Any]] = None, reply_to_message_id: Optional[str] = None, disable_notification: bool = False, chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2206
|
+
return await self._send_file_generic("Image", chat_id, path, file_id, text, file_name, inline_keypad, chat_keypad, reply_to_message_id, disable_notification, chat_keypad_type,parse_mode=parse_mode,meta_data=meta_data)
|
|
2194
2207
|
async def send_music(
|
|
2195
2208
|
self,
|
|
2196
2209
|
chat_id: str,
|
|
@@ -2203,7 +2216,8 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2203
2216
|
reply_to_message_id: Optional[str] = None,
|
|
2204
2217
|
disable_notification: bool = False,
|
|
2205
2218
|
chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",
|
|
2206
|
-
parse_mode: Optional[Literal["HTML", "Markdown"]] = None
|
|
2219
|
+
parse_mode: Optional[Literal["HTML", "Markdown"]] = None,
|
|
2220
|
+
meta_data:Optional[dict] = None
|
|
2207
2221
|
) -> Dict[str, Any]:
|
|
2208
2222
|
valid_extensions = {"ogg", "oga", "opus", "flac"}
|
|
2209
2223
|
extension = "flac"
|
|
@@ -2236,7 +2250,8 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2236
2250
|
reply_to_message_id,
|
|
2237
2251
|
disable_notification,
|
|
2238
2252
|
chat_keypad_type,
|
|
2239
|
-
parse_mode=parse_mode
|
|
2253
|
+
parse_mode=parse_mode,
|
|
2254
|
+
meta_data=meta_data
|
|
2240
2255
|
)
|
|
2241
2256
|
async def send_gif(
|
|
2242
2257
|
self,
|
|
@@ -2250,7 +2265,8 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2250
2265
|
reply_to_message_id: Optional[str] = None,
|
|
2251
2266
|
disable_notification: bool = False,
|
|
2252
2267
|
chat_keypad_type: Optional[Literal["New", "Remove", "None"]] = "None",
|
|
2253
|
-
parse_mode: Optional[Literal["HTML", "Markdown"]] = None
|
|
2268
|
+
parse_mode: Optional[Literal["HTML", "Markdown"]] = None,
|
|
2269
|
+
meta_data:Optional[dict] = None
|
|
2254
2270
|
) -> Dict[str, Any]:
|
|
2255
2271
|
valid_extensions = {"gif"}
|
|
2256
2272
|
extension = "gif"
|
|
@@ -2283,7 +2299,7 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2283
2299
|
reply_to_message_id,
|
|
2284
2300
|
disable_notification,
|
|
2285
2301
|
chat_keypad_type,
|
|
2286
|
-
parse_mode=parse_mode
|
|
2302
|
+
parse_mode=parse_mode,meta_data=meta_data
|
|
2287
2303
|
)
|
|
2288
2304
|
|
|
2289
2305
|
async def get_avatar_me(self, save_as: str = None) -> str:
|
|
@@ -2427,18 +2443,21 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
|
|
|
2427
2443
|
return await self._post("leaveChat", {"chat_id": chat_id})
|
|
2428
2444
|
async def forward_message(self, from_chat_id: str, message_id: str, to_chat_id: str, disable_notification: bool = False) -> Dict[str, Any]:
|
|
2429
2445
|
return await self._post("forwardMessage", {"from_chat_id": from_chat_id, "message_id": message_id, "to_chat_id": to_chat_id, "disable_notification": disable_notification})
|
|
2430
|
-
async def edit_message_text(self, chat_id: str, message_id: str, text: str, parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
|
|
2446
|
+
async def edit_message_text(self, chat_id: str, message_id: str, text: str, parse_mode: Optional[Literal["HTML", "Markdown"]] = None,meta_data:Optional[dict] = None) -> Dict[str, Any]:
|
|
2431
2447
|
payload = {
|
|
2432
2448
|
"chat_id": chat_id,
|
|
2433
2449
|
"message_id": message_id,
|
|
2434
2450
|
"text": text,
|
|
2435
2451
|
}
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2452
|
+
if not meta_data:
|
|
2453
|
+
parse_mode_to_use = parse_mode or self.parse_mode
|
|
2454
|
+
if text:
|
|
2455
|
+
text, metadata = self._parse_text_metadata(text, parse_mode_to_use)
|
|
2456
|
+
payload["text"] = text
|
|
2457
|
+
if metadata:
|
|
2458
|
+
payload["metadata"] = metadata
|
|
2459
|
+
else :
|
|
2460
|
+
payload["metadata"] = meta_data
|
|
2442
2461
|
return await self._post("editMessageText", payload)
|
|
2443
2462
|
async def edit_inline_keypad(self,chat_id: str,message_id: str,inline_keypad: Dict[str, Any],text: str = None) -> Dict[str, Any]:
|
|
2444
2463
|
if text is not None:await self._post("editMessageText", {"chat_id": chat_id,"message_id": message_id,"text": text})
|
rubka/context.py
CHANGED
|
@@ -288,6 +288,7 @@ class Message:
|
|
|
288
288
|
self.is_audio = None
|
|
289
289
|
self.is_voice = None
|
|
290
290
|
self.is_document = None
|
|
291
|
+
self.is_music = None
|
|
291
292
|
self.is_archive = None
|
|
292
293
|
self.is_executable = None
|
|
293
294
|
self.is_font = None
|
|
@@ -356,6 +357,7 @@ class Message:
|
|
|
356
357
|
self.is_photo = name.endswith((".jpg", ".jpeg", ".png", ".gif", ".webp"))
|
|
357
358
|
self.is_video = name.endswith((".mp4", ".mov", ".avi", ".mkv", ".webm"))
|
|
358
359
|
self.is_audio = name.endswith((".mp3", ".wav", ".ogg", ".m4a", ".flac"))
|
|
360
|
+
self.is_music = name.endswith((".mp3", ".wav", ".ogg", ".m4a", ".flac"))
|
|
359
361
|
self.is_voice = name.endswith((".ogg", ".m4a"))
|
|
360
362
|
self.is_document = name.endswith((".pdf", ".doc", ".docx", ".txt", ".xls", ".xlsx", ".ppt", ".pptx"))
|
|
361
363
|
self.is_archive = name.endswith((".zip", ".rar", ".7z", ".tar", ".gz"))
|
|
@@ -437,8 +439,32 @@ class Message:
|
|
|
437
439
|
reply_to_message_id=self.message_id,
|
|
438
440
|
**kwargs
|
|
439
441
|
)
|
|
440
|
-
|
|
441
|
-
|
|
442
|
+
async def copy(self, to_chat_id: Optional[str], message_id: Optional[str] = None):await self.copy_message(to_chat_id, message_id)
|
|
443
|
+
async def copy_message(self, to_chat_id: Optional[str], message_id: Optional[str] = None):
|
|
444
|
+
try:
|
|
445
|
+
send_func = None
|
|
446
|
+
kwargs = {
|
|
447
|
+
"chat_id": to_chat_id,
|
|
448
|
+
"reply_to_message_id": message_id,
|
|
449
|
+
"meta_data": self.metadata
|
|
450
|
+
}
|
|
451
|
+
if getattr(self, "is_photo", False):
|
|
452
|
+
send_func = self.bot.send_image
|
|
453
|
+
elif getattr(self, "is_video", False):
|
|
454
|
+
send_func = self.bot.send_video
|
|
455
|
+
elif getattr(self, "is_document", False):
|
|
456
|
+
send_func = self.bot.send_document
|
|
457
|
+
elif getattr(self, "is_text", False):
|
|
458
|
+
send_func = self.bot.send_message
|
|
459
|
+
kwargs["text"] = self.text
|
|
460
|
+
if send_func:
|
|
461
|
+
if hasattr(self, "file") and self.file:
|
|
462
|
+
kwargs["path"] = await self.bot.get_url_file(self.file.file_id)
|
|
463
|
+
return await send_func(**kwargs)
|
|
464
|
+
else:
|
|
465
|
+
raise Exception("Unsupported message type.")
|
|
466
|
+
except Exception as e:
|
|
467
|
+
raise Exception(f"Error: {e}")
|
|
442
468
|
def reply_poll(
|
|
443
469
|
self,
|
|
444
470
|
question: str,
|
rubka/filters.py
CHANGED
|
@@ -244,9 +244,10 @@ def chat_title_equals(value: str):
|
|
|
244
244
|
|
|
245
245
|
return Filter(lambda m: getattr(m, "chat", None) and getattr(m.chat, "title", "") == value)
|
|
246
246
|
|
|
247
|
-
def chat_id_is(
|
|
248
|
-
return Filter(lambda m: getattr(m, "
|
|
249
|
-
|
|
247
|
+
def chat_id_is(sender_id: str):
|
|
248
|
+
return Filter(lambda m: getattr(m, "chat_id", None) == sender_id)
|
|
249
|
+
def sender_id_is(sender_id: str):
|
|
250
|
+
return Filter(lambda m: getattr(m, "sender_id", None) == sender_id)
|
|
250
251
|
def chat_member_count(min_count: int = 0, max_count: int = None):
|
|
251
252
|
|
|
252
253
|
def _filter(m):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Rubka
|
|
3
|
-
Version: 7.1
|
|
3
|
+
Version: 7.2.1
|
|
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,12 +1,12 @@
|
|
|
1
1
|
rubka/__init__.py,sha256=P6IBiORfp-GqKHe5LZ-5lldWyG7tnrUYUcAQDUgwXmY,1973
|
|
2
2
|
rubka/api.py,sha256=71B10uy2iU3gP6yHQltjyTkq2mgkzWuV1TsE2kgHOZg,68092
|
|
3
|
-
rubka/asynco.py,sha256=
|
|
3
|
+
rubka/asynco.py,sha256=Rs1-y-dcxVYyQZzJuARI7_T0Lj4Ttl62N3UIranIJYI,121464
|
|
4
4
|
rubka/button.py,sha256=woSzZVd5MtTqOrP-YgkH5b0GS9y4DuKBsFSc9-KuLnk,13320
|
|
5
5
|
rubka/config.py,sha256=Bck59xkOiqioLv0GkQ1qPGnBXVctz1hKk6LT4h2EPx0,78
|
|
6
|
-
rubka/context.py,sha256=
|
|
6
|
+
rubka/context.py,sha256=rvdnZYDcOIEvQhl3fAt2HfTw2IGozCtHffhCk_56FEQ,43879
|
|
7
7
|
rubka/decorators.py,sha256=hGwUoE4q2ImrunJIGJ_kzGYYxQf1ueE0isadqraKEts,1157
|
|
8
8
|
rubka/exceptions.py,sha256=DDOGIHEMoliHNW5E7C_s38WZgqqMBv9812fcJGvj7TY,1173
|
|
9
|
-
rubka/filters.py,sha256=
|
|
9
|
+
rubka/filters.py,sha256=XeobfZA6lBsr4-cfRYvEh9L4sRmJP1gJ1PPNhr8bPr8,13343
|
|
10
10
|
rubka/helpers.py,sha256=QvK5lg4QDmycImxJia4m8HDpfacYzbKKZiOk536mafc,65161
|
|
11
11
|
rubka/jobs.py,sha256=GvLMLsVhcSEzRTgkvnPISPEBN71suW2xXI0hUaUZPTo,378
|
|
12
12
|
rubka/keyboards.py,sha256=7nr-dT2bQJVQnQ6RMWPTSjML6EEk6dsBx-4d8pab8xk,488
|
|
@@ -38,8 +38,8 @@ rubka/adaptorrubka/types/socket/message.py,sha256=0WgLMZh4eow8Zn7AiSX4C3GZjQTkIg
|
|
|
38
38
|
rubka/adaptorrubka/utils/__init__.py,sha256=OgCFkXdNFh379quNwIVOAWY2NP5cIOxU5gDRRALTk4o,54
|
|
39
39
|
rubka/adaptorrubka/utils/configs.py,sha256=nMUEOJh1NqDJsf9W9PurkN_DLYjO6kKPMm923i4Jj_A,492
|
|
40
40
|
rubka/adaptorrubka/utils/utils.py,sha256=5-LioLNYX_TIbQGDeT50j7Sg9nAWH2LJUUs-iEXpsUY,8816
|
|
41
|
-
rubka-7.1.
|
|
42
|
-
rubka-7.1.
|
|
43
|
-
rubka-7.1.
|
|
44
|
-
rubka-7.1.
|
|
45
|
-
rubka-7.1.
|
|
41
|
+
rubka-7.2.1.dist-info/METADATA,sha256=MFn2TgrAxy5xH810JoaHxi_0NveqHuPvV5GHduSqW3w,34672
|
|
42
|
+
rubka-7.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
43
|
+
rubka-7.2.1.dist-info/entry_points.txt,sha256=4aESuUmuUOALMUy7Kucv_Gb5YlqhsJmTmdXLlZU9sJ0,46
|
|
44
|
+
rubka-7.2.1.dist-info/top_level.txt,sha256=vy2A4lot11cRMdQS-F4HDCIXL3JK8RKfu7HMDkezJW4,6
|
|
45
|
+
rubka-7.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|