Rubka 7.1.15__tar.gz → 7.1.17__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.
Files changed (51) hide show
  1. {rubka-7.1.15 → rubka-7.1.17}/PKG-INFO +1 -1
  2. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/PKG-INFO +1 -1
  3. {rubka-7.1.15 → rubka-7.1.17}/rubka/asynco.py +25 -5
  4. {rubka-7.1.15 → rubka-7.1.17}/setup.py +1 -1
  5. {rubka-7.1.15 → rubka-7.1.17}/README.md +0 -0
  6. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/SOURCES.txt +0 -0
  7. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/dependency_links.txt +0 -0
  8. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/entry_points.txt +0 -0
  9. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/not-zip-safe +0 -0
  10. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/requires.txt +0 -0
  11. {rubka-7.1.15 → rubka-7.1.17}/Rubka.egg-info/top_level.txt +0 -0
  12. {rubka-7.1.15 → rubka-7.1.17}/rubka/__init__.py +0 -0
  13. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/__init__.py +0 -0
  14. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/client/__init__.py +0 -0
  15. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/client/client.py +0 -0
  16. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/crypto/__init__.py +0 -0
  17. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/crypto/crypto.py +0 -0
  18. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/enums.py +0 -0
  19. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/exceptions.py +0 -0
  20. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/methods/__init__.py +0 -0
  21. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/methods/methods.py +0 -0
  22. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/network/__init__.py +0 -0
  23. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/network/helper.py +0 -0
  24. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/network/network.py +0 -0
  25. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/network/socket.py +0 -0
  26. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/sessions/__init__.py +0 -0
  27. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/sessions/sessions.py +0 -0
  28. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/types/__init__.py +0 -0
  29. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/types/socket/__init__.py +0 -0
  30. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/types/socket/message.py +0 -0
  31. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/utils/__init__.py +0 -0
  32. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/utils/configs.py +0 -0
  33. {rubka-7.1.15 → rubka-7.1.17}/rubka/adaptorrubka/utils/utils.py +0 -0
  34. {rubka-7.1.15 → rubka-7.1.17}/rubka/api.py +0 -0
  35. {rubka-7.1.15 → rubka-7.1.17}/rubka/button.py +0 -0
  36. {rubka-7.1.15 → rubka-7.1.17}/rubka/config.py +0 -0
  37. {rubka-7.1.15 → rubka-7.1.17}/rubka/context.py +0 -0
  38. {rubka-7.1.15 → rubka-7.1.17}/rubka/decorators.py +0 -0
  39. {rubka-7.1.15 → rubka-7.1.17}/rubka/exceptions.py +0 -0
  40. {rubka-7.1.15 → rubka-7.1.17}/rubka/filters.py +0 -0
  41. {rubka-7.1.15 → rubka-7.1.17}/rubka/helpers.py +0 -0
  42. {rubka-7.1.15 → rubka-7.1.17}/rubka/jobs.py +0 -0
  43. {rubka-7.1.15 → rubka-7.1.17}/rubka/keyboards.py +0 -0
  44. {rubka-7.1.15 → rubka-7.1.17}/rubka/keypad.py +0 -0
  45. {rubka-7.1.15 → rubka-7.1.17}/rubka/logger.py +0 -0
  46. {rubka-7.1.15 → rubka-7.1.17}/rubka/metadata.py +0 -0
  47. {rubka-7.1.15 → rubka-7.1.17}/rubka/rubino.py +0 -0
  48. {rubka-7.1.15 → rubka-7.1.17}/rubka/tv.py +0 -0
  49. {rubka-7.1.15 → rubka-7.1.17}/rubka/update.py +0 -0
  50. {rubka-7.1.15 → rubka-7.1.17}/rubka/utils.py +0 -0
  51. {rubka-7.1.15 → rubka-7.1.17}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 7.1.15
3
+ Version: 7.1.17
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
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 7.1.15
3
+ Version: 7.1.17
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
@@ -171,7 +171,10 @@ def get_installed_version(package_name: str) -> Optional[str]:
171
171
  return version(package_name)
172
172
  except PackageNotFoundError:
173
173
  return None
174
-
174
+ BASE_URLS = {
175
+ "botapi": "https://botapi.rubika.ir/v3",
176
+ "messenger": "https://messengerg2b1.iranlms.ir/v3"
177
+ }
175
178
  async def get_latest_version(package_name: str) -> Optional[str]:
176
179
  url = f"https://pypi.org/pypi/{package_name}/json"
177
180
  try:
@@ -265,7 +268,8 @@ safeSendMode ensures reliable message sending even if replying by message_id fai
265
268
  max_cache_size and max_msg_age help manage duplicate message processing efficiently.
266
269
  """
267
270
 
268
- def __init__(self, token: str, session_name: str = None, auth: str = None, Key: str = None, platform: str = "web", web_hook: str = None, timeout: int = 10, show_progress: bool = False, raise_errors: bool = True,proxy: str = None,retries: int = 2,retry_delay: float = 0.5,user_agent: str = None,safeSendMode = False,max_cache_size: int = 2000,max_msg_age : int = 60,chunk_size : int = 64 * 1024,parse_mode: Optional[Literal["HTML", "Markdown"]] = "Markdown"):
271
+
272
+ def __init__(self, token: str, session_name: str = None, auth: str = None, Key: str = None, platform: str = "web", web_hook: str = None, timeout: int = 10, show_progress: bool = False, raise_errors: bool = True,proxy: str = None,retries: int = 2,retry_delay: float = 0.5,user_agent: str = None,safeSendMode = False,max_cache_size: int = 2000,max_msg_age : int = 60,chunk_size : int = 64 * 1024,parse_mode: Optional[Literal["HTML", "Markdown"]] = "Markdown",api_endpoint: Optional[Literal["botapi", "messenger"]] = "botapi"):
269
273
  self.token = token
270
274
  self._inline_query_handlers: List[dict] = []
271
275
  self.timeout = timeout
@@ -276,6 +280,7 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
276
280
  self.proxy = proxy
277
281
  self.max_msg_age = max_msg_age
278
282
  self.retries = retries
283
+
279
284
  self.retry_delay = retry_delay
280
285
  self.raise_errors = raise_errors
281
286
  self.show_progress = show_progress
@@ -297,6 +302,8 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
297
302
  self._db_path = os.path.join(os.getcwd(), "RubkaSaveMessage.db")
298
303
  self._ensure_db()
299
304
  self._message_handlers: List[dict] = []
305
+ if api_endpoint not in BASE_URLS:raise ValueError(f"api_endpoint must be one of {list(BASE_URLS.keys())}")
306
+ self.api_endpoint = api_endpoint
300
307
 
301
308
  logger.info(f"Initialized RubikaBot with token: {token[:8]}***")
302
309
  async def _get_session(self) -> aiohttp.ClientSession:
@@ -337,7 +344,9 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
337
344
  logger.error(f"Failed to set webhook from {self.web_hook}: {e}")
338
345
  self.web_hook = None
339
346
  async def _post(self, method: str, data: Dict[str, Any]) -> Dict[str, Any]:
340
- url = f"{API_URL}/{self.token}/{method}"
347
+ base_url = BASE_URLS[self.api_endpoint]
348
+ url = f"{base_url}/{self.token}/{method}"
349
+ print(url)
341
350
  session = await self._get_session()
342
351
  for attempt in range(1, self.retries + 1):
343
352
  try:
@@ -2419,8 +2428,19 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2419
2428
  return await self._post("leaveChat", {"chat_id": chat_id})
2420
2429
  async def forward_message(self, from_chat_id: str, message_id: str, to_chat_id: str, disable_notification: bool = False) -> Dict[str, Any]:
2421
2430
  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})
2422
- async def edit_message_text(self, chat_id: str, message_id: str, text: str) -> Dict[str, Any]:
2423
- return await self._post("editMessageText", {"chat_id": chat_id, "message_id": message_id, "text": text})
2431
+ async def edit_message_text(self, chat_id: str, message_id: str, text: str, parse_mode: Optional[Literal["HTML", "Markdown"]] = None) -> Dict[str, Any]:
2432
+ payload = {
2433
+ "chat_id": chat_id,
2434
+ "message_id": message_id,
2435
+ "text": text,
2436
+ }
2437
+ parse_mode_to_use = parse_mode or self.parse_mode
2438
+ if text:
2439
+ text, metadata = self._parse_text_metadata(text, parse_mode_to_use)
2440
+ payload["text"] = text
2441
+ if metadata:
2442
+ payload["metadata"] = metadata
2443
+ return await self._post("editMessageText", payload)
2424
2444
  async def edit_inline_keypad(self,chat_id: str,message_id: str,inline_keypad: Dict[str, Any],text: str = None) -> Dict[str, Any]:
2425
2445
  if text is not None:await self._post("editMessageText", {"chat_id": chat_id,"message_id": message_id,"text": text})
2426
2446
  return await self._post("editMessageKeypad", {"chat_id": chat_id,"message_id": message_id,"inline_keypad": inline_keypad})
@@ -13,7 +13,7 @@ with open("README.md", "r", encoding="utf-8") as f:
13
13
 
14
14
  setup(
15
15
  name='Rubka',
16
- version='7.1.15',
16
+ version='7.1.17',
17
17
  description=(
18
18
  "Rubika: A Python library for interacting with the Rubika Bot API. "
19
19
  "This library provides an easy-to-use interface to send messages, polls, "
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes