Rubka 7.2.1__tar.gz → 7.2.2__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.2.1 → rubka-7.2.2}/PKG-INFO +1 -1
  2. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/PKG-INFO +1 -1
  3. {rubka-7.2.1 → rubka-7.2.2}/rubka/__init__.py +1 -2
  4. {rubka-7.2.1 → rubka-7.2.2}/rubka/asynco.py +16 -5
  5. {rubka-7.2.1 → rubka-7.2.2}/rubka/filters.py +9 -1
  6. {rubka-7.2.1 → rubka-7.2.2}/rubka/rubino.py +41 -1
  7. {rubka-7.2.1 → rubka-7.2.2}/setup.py +1 -1
  8. {rubka-7.2.1 → rubka-7.2.2}/README.md +0 -0
  9. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/SOURCES.txt +0 -0
  10. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/dependency_links.txt +0 -0
  11. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/entry_points.txt +0 -0
  12. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/not-zip-safe +0 -0
  13. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/requires.txt +0 -0
  14. {rubka-7.2.1 → rubka-7.2.2}/Rubka.egg-info/top_level.txt +0 -0
  15. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/__init__.py +0 -0
  16. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/client/__init__.py +0 -0
  17. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/client/client.py +0 -0
  18. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/crypto/__init__.py +0 -0
  19. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/crypto/crypto.py +0 -0
  20. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/enums.py +0 -0
  21. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/exceptions.py +0 -0
  22. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/methods/__init__.py +0 -0
  23. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/methods/methods.py +0 -0
  24. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/network/__init__.py +0 -0
  25. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/network/helper.py +0 -0
  26. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/network/network.py +0 -0
  27. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/network/socket.py +0 -0
  28. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/sessions/__init__.py +0 -0
  29. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/sessions/sessions.py +0 -0
  30. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/types/__init__.py +0 -0
  31. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/types/socket/__init__.py +0 -0
  32. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/types/socket/message.py +0 -0
  33. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/utils/__init__.py +0 -0
  34. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/utils/configs.py +0 -0
  35. {rubka-7.2.1 → rubka-7.2.2}/rubka/adaptorrubka/utils/utils.py +0 -0
  36. {rubka-7.2.1 → rubka-7.2.2}/rubka/api.py +0 -0
  37. {rubka-7.2.1 → rubka-7.2.2}/rubka/button.py +0 -0
  38. {rubka-7.2.1 → rubka-7.2.2}/rubka/config.py +0 -0
  39. {rubka-7.2.1 → rubka-7.2.2}/rubka/context.py +0 -0
  40. {rubka-7.2.1 → rubka-7.2.2}/rubka/decorators.py +0 -0
  41. {rubka-7.2.1 → rubka-7.2.2}/rubka/exceptions.py +0 -0
  42. {rubka-7.2.1 → rubka-7.2.2}/rubka/helpers.py +0 -0
  43. {rubka-7.2.1 → rubka-7.2.2}/rubka/jobs.py +0 -0
  44. {rubka-7.2.1 → rubka-7.2.2}/rubka/keyboards.py +0 -0
  45. {rubka-7.2.1 → rubka-7.2.2}/rubka/keypad.py +0 -0
  46. {rubka-7.2.1 → rubka-7.2.2}/rubka/logger.py +0 -0
  47. {rubka-7.2.1 → rubka-7.2.2}/rubka/metadata.py +0 -0
  48. {rubka-7.2.1 → rubka-7.2.2}/rubka/tv.py +0 -0
  49. {rubka-7.2.1 → rubka-7.2.2}/rubka/update.py +0 -0
  50. {rubka-7.2.1 → rubka-7.2.2}/rubka/utils.py +0 -0
  51. {rubka-7.2.1 → rubka-7.2.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 7.2.1
3
+ Version: 7.2.2
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.2.1
3
+ Version: 7.2.2
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
@@ -66,8 +66,7 @@ Sync = simple, step-by-step, blocking.
66
66
  Async = scalable, concurrent, non-blocking.
67
67
  """
68
68
 
69
- from .api import Robot
70
- from .rubino import Bot
69
+ from .api import Robot,Bot,robot,bot
71
70
  from .exceptions import APIRequestError
72
71
  from .rubino import Bot as rubino
73
72
  from .tv import TV as TvRubika
@@ -2026,7 +2026,7 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2026
2026
  if reply_to_message_id: payload["reply_to_message_id"] = reply_to_message_id
2027
2027
  if chat_keypad_type: payload["chat_keypad_type"] = chat_keypad_type
2028
2028
  return await self._post("sendLocation", {k: v for k, v in payload.items() if v is not None})
2029
- async def upload_media_file(self, upload_url: str, name: str, path: Union[str, Path]) -> str:
2029
+ async def upload_media_file(self, upload_url: str, name: str, path: Union[str, Path, bytes]) -> str:
2030
2030
  session = await self._get_session()
2031
2031
  is_temp_file = False
2032
2032
  if isinstance(path, str) and path.startswith("http"):
@@ -2038,12 +2038,17 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2038
2038
  tmp.write(content)
2039
2039
  path = tmp.name
2040
2040
  is_temp_file = True
2041
+ elif isinstance(path, bytes):
2042
+ with tempfile.NamedTemporaryFile(delete=False) as tmp:
2043
+ tmp.write(path)
2044
+ path = tmp.name
2045
+ is_temp_file = True
2041
2046
 
2042
2047
  file_size = os.path.getsize(path)
2043
2048
  chunk_size = self.chunk_size
2044
2049
 
2045
2050
  progress_bar = tqdm(total=file_size, unit='B', unit_scale=True, unit_divisor=1024,
2046
- desc=f'Uploading: {name}', colour='cyan', disable=not getattr(self, 'show_progress', True))
2051
+ desc=f'Upload : {name}', colour='blue', disable=not getattr(self, 'show_progress', True))
2047
2052
 
2048
2053
  async def file_generator(file_path):
2049
2054
  async with aiofiles.open(file_path, 'rb') as f:
@@ -2053,7 +2058,6 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2053
2058
 
2054
2059
  form = aiohttp.FormData()
2055
2060
  form.add_field('file', file_generator(path), filename=name, content_type='application/octet-stream')
2056
-
2057
2061
  try:
2058
2062
  async with session.post(upload_url, data=form, timeout=aiohttp.ClientTimeout(total=None)) as response:
2059
2063
  progress_bar.close()
@@ -2062,7 +2066,7 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2062
2066
  raise Exception(f"Upload failed ({response.status}): {text}")
2063
2067
  return (await response.json()).get('data', {}).get('file_id')
2064
2068
  except Exception as e:
2065
- raise FeatureNotAvailableError(f"File upload not supported: {e}")
2069
+ raise FeatureNotAvailableError(f"File upload not supported : {e}")
2066
2070
  finally:
2067
2071
  if is_temp_file:
2068
2072
  os.remove(path)
@@ -2530,4 +2534,11 @@ max_cache_size and max_msg_age help manage duplicate message processing efficien
2530
2534
  result = await asyncio.to_thread(self.get_all_member, channel_guid, search_text=first_name)
2531
2535
  members = result.get('in_chat_members', [])
2532
2536
  return any(m.get('first_name') == first_name for m in members)
2533
- return False
2537
+ return False
2538
+
2539
+ class Bot(Robot):
2540
+ pass
2541
+ class bot(Robot):
2542
+ pass
2543
+ class robot(Robot):
2544
+ pass
@@ -1,4 +1,4 @@
1
- from typing import Callable
1
+ from typing import Callable,Union
2
2
  import re
3
3
  class TextFilter:
4
4
  def __call__(self, keyword=None):
@@ -248,6 +248,14 @@ def chat_id_is(sender_id: str):
248
248
  return Filter(lambda m: getattr(m, "chat_id", None) == sender_id)
249
249
  def sender_id_is(sender_id: str):
250
250
  return Filter(lambda m: getattr(m, "sender_id", None) == sender_id)
251
+ def senders_id(sender_ids: Union[str, list]):
252
+ if isinstance(sender_ids, list):
253
+ return Filter(lambda m: getattr(m, "sender_id", None) in sender_ids)
254
+ return Filter(lambda m: getattr(m, "sender_id", None) == sender_ids)
255
+ def chat_ids(sender_ids: Union[str, list]):
256
+ if isinstance(sender_ids, list):
257
+ return Filter(lambda m: getattr(m, "chat_id", None) in sender_ids)
258
+ return Filter(lambda m: getattr(m, "chat_id", None) == sender_ids)
251
259
  def chat_member_count(min_count: int = 0, max_count: int = None):
252
260
 
253
261
  def _filter(m):
@@ -1228,4 +1228,44 @@ class Bot():
1228
1228
  "limit": limit,
1229
1229
  "sort": sort
1230
1230
  }
1231
- return self._reuests_post("getNewFollowRequests", data=payload)
1231
+ return self._reuests_post("getNewFollowRequests", data=payload)
1232
+ def get_myprofile_posts(
1233
+ self,
1234
+ profile_id: Optional[str] = None ,
1235
+ limit: int = 20,
1236
+ sort: str = "FromMax"
1237
+ ) -> Dict[str, Any]:
1238
+ payload = {
1239
+ "profile_id": profile_id,
1240
+ "limit": limit,
1241
+ "sort": sort
1242
+ }
1243
+ return self._reuests_post("getMyProfilePosts", data=payload)
1244
+ def get_recent_following_posts(
1245
+ self,
1246
+ profile_id: Optional[str] = None ,
1247
+ limit: int = 20,
1248
+ sort: str = "FromMax"
1249
+ ) -> Dict[str, Any]:
1250
+ payload = {
1251
+ "profile_id": profile_id,
1252
+ "limit": limit,
1253
+ "sort": sort
1254
+ }
1255
+ return self._reuests_post("getRecentFollowingPosts", data=payload)
1256
+ def get_explore_post_topics(
1257
+ self,
1258
+ profile_id: Optional[str] = None ,
1259
+ ) -> Dict[str, Any]:
1260
+ payload = {
1261
+ "profile_id": profile_id,
1262
+ }
1263
+ return self._reuests_post("getExplorePostTopics", data=payload)
1264
+ def get_profiles_stories(
1265
+ self,
1266
+ profile_id: Optional[str] = None ,
1267
+ ) -> Dict[str, Any]:
1268
+ payload = {
1269
+ "profile_id": profile_id,
1270
+ }
1271
+ return self._reuests_post("getProfilesStories", data=payload)
@@ -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.2.1',
16
+ version='7.2.2',
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
File without changes