Rubka 4.6.2__tar.gz → 5.0.0__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 (44) hide show
  1. {rubka-4.6.2 → rubka-5.0.0}/PKG-INFO +1 -1
  2. {rubka-4.6.2 → rubka-5.0.0}/Rubka.egg-info/PKG-INFO +1 -1
  3. {rubka-4.6.2 → rubka-5.0.0}/rubka/api.py +9 -0
  4. {rubka-4.6.2 → rubka-5.0.0}/rubka/asynco.py +9 -0
  5. {rubka-4.6.2 → rubka-5.0.0}/rubka/button.py +109 -0
  6. {rubka-4.6.2 → rubka-5.0.0}/setup.py +1 -1
  7. {rubka-4.6.2 → rubka-5.0.0}/README.md +0 -0
  8. {rubka-4.6.2 → rubka-5.0.0}/Rubka.egg-info/SOURCES.txt +0 -0
  9. {rubka-4.6.2 → rubka-5.0.0}/Rubka.egg-info/dependency_links.txt +0 -0
  10. {rubka-4.6.2 → rubka-5.0.0}/Rubka.egg-info/requires.txt +0 -0
  11. {rubka-4.6.2 → rubka-5.0.0}/Rubka.egg-info/top_level.txt +0 -0
  12. {rubka-4.6.2 → rubka-5.0.0}/rubka/__init__.py +0 -0
  13. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/__init__.py +0 -0
  14. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/client/__init__.py +0 -0
  15. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/client/client.py +0 -0
  16. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/crypto/__init__.py +0 -0
  17. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/crypto/crypto.py +0 -0
  18. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/enums.py +0 -0
  19. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/exceptions.py +0 -0
  20. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/methods/__init__.py +0 -0
  21. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/methods/methods.py +0 -0
  22. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/network/__init__.py +0 -0
  23. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/network/helper.py +0 -0
  24. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/network/network.py +0 -0
  25. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/network/socket.py +0 -0
  26. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/sessions/__init__.py +0 -0
  27. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/sessions/sessions.py +0 -0
  28. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/types/__init__.py +0 -0
  29. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/types/socket/__init__.py +0 -0
  30. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/types/socket/message.py +0 -0
  31. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/utils/__init__.py +0 -0
  32. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/utils/configs.py +0 -0
  33. {rubka-4.6.2 → rubka-5.0.0}/rubka/adaptorrubka/utils/utils.py +0 -0
  34. {rubka-4.6.2 → rubka-5.0.0}/rubka/config.py +0 -0
  35. {rubka-4.6.2 → rubka-5.0.0}/rubka/context.py +0 -0
  36. {rubka-4.6.2 → rubka-5.0.0}/rubka/decorators.py +0 -0
  37. {rubka-4.6.2 → rubka-5.0.0}/rubka/exceptions.py +0 -0
  38. {rubka-4.6.2 → rubka-5.0.0}/rubka/jobs.py +0 -0
  39. {rubka-4.6.2 → rubka-5.0.0}/rubka/keyboards.py +0 -0
  40. {rubka-4.6.2 → rubka-5.0.0}/rubka/keypad.py +0 -0
  41. {rubka-4.6.2 → rubka-5.0.0}/rubka/logger.py +0 -0
  42. {rubka-4.6.2 → rubka-5.0.0}/rubka/rubino.py +0 -0
  43. {rubka-4.6.2 → rubka-5.0.0}/rubka/utils.py +0 -0
  44. {rubka-4.6.2 → rubka-5.0.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 4.6.2
3
+ Version: 5.0.0
4
4
  Summary: A Python library for interacting with Rubika Bot API.
5
5
  Home-page: https://github.com/Mahdy-Ahmadi/Rubka
6
6
  Download-URL: https://github.com/Mahdy-Ahmadi/rubka/blob/main/project_library.zip
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: Rubka
3
- Version: 4.6.2
3
+ Version: 5.0.0
4
4
  Summary: A Python library for interacting with Rubika Bot API.
5
5
  Home-page: https://github.com/Mahdy-Ahmadi/Rubka
6
6
  Download-URL: https://github.com/Mahdy-Ahmadi/rubka/blob/main/project_library.zip
@@ -172,6 +172,15 @@ class Robot:
172
172
  })
173
173
  return func
174
174
  return decorator
175
+ def on_update(self, filters: Optional[Callable[[Message], bool]] = None, commands: Optional[List[str]] = None):
176
+ def decorator(func: Callable[[Any, Message], None]):
177
+ self._message_handlers.append({
178
+ "func": func,
179
+ "filters": filters,
180
+ "commands": commands
181
+ })
182
+ return func
183
+ return decorator
175
184
 
176
185
  def on_callback(self, button_id: Optional[str] = None):
177
186
  def decorator(func: Callable[[Any, Message], None]):
@@ -196,6 +196,15 @@ class Robot:
196
196
  })
197
197
  return func
198
198
  return decorator
199
+ def on_update(self, filters: Optional[Callable[[Message], bool]] = None, commands: Optional[List[str]] = None):
200
+ def decorator(func: Callable[[Any, Message], None]):
201
+ self._message_handlers.append({
202
+ "func": func,
203
+ "filters": filters,
204
+ "commands": commands
205
+ })
206
+ return func
207
+ return decorator
199
208
 
200
209
  def on_callback(self, button_id: Optional[str] = None):
201
210
  def decorator(func: Callable[[Any, Message], None]):
@@ -16,6 +16,115 @@ class InlineBuilder:
16
16
  raise ValueError("حداقل یک دکمه باید به row داده شود")
17
17
  self.rows.append({"buttons": list(buttons)})
18
18
  return self
19
+ def button_open_chat(self, id: str, text: str, object_guid: str, object_type: str ="User") -> Dict:
20
+ return {
21
+ "id": id,
22
+ "type": 'Link',
23
+ "button_text": text,
24
+ "button_link": {
25
+ "type": 'openchat',
26
+ "open_chat_data": {
27
+ "object_guid": object_guid,
28
+ "object_type": object_type
29
+ }
30
+ }
31
+ }
32
+ def button_join_channel(self, id: str, text: str, username: str, ask_join: bool = False) -> Dict:
33
+ """
34
+ Creates an inline button that prompts the user to join a Rubika channel.
35
+
36
+ Args:
37
+ id (str): Unique identifier for the button (used for event handling).
38
+ text (str): The text displayed on the button.
39
+ username (str): The channel username (can be with or without '@').
40
+ ask_join (bool, optional): If True, the user will be prompted with a
41
+ confirmation dialog before joining.
42
+ Defaults to False.
43
+
44
+ Returns:
45
+ dict: A dictionary representing the inline button, which can be passed
46
+ to inline keyboard builder methods.
47
+
48
+ Example:
49
+ ```python
50
+ from rubka.button import InlineBuilder
51
+
52
+ buttons = (
53
+ InlineBuilder()
54
+ .row(
55
+ InlineBuilder().button_join_channel(
56
+ id="join_btn",
57
+ text="Join our channel 📢",
58
+ username="rubka_library",
59
+ ask_join=True
60
+ )
61
+ )
62
+ .build()
63
+ )
64
+
65
+ await message.reply_inline(
66
+ text="Please join our channel before using the bot.",
67
+ inline_keypad=buttons
68
+ )
69
+ ```
70
+ """
71
+ return {
72
+ "id": id,
73
+ "type": 'Link',
74
+ "button_text": text,
75
+ "button_link": {
76
+ "type": 'joinchannel',
77
+ "joinchannel_data": {
78
+ "username": username.replace("@", ""),
79
+ "ask_join": ask_join
80
+ }
81
+ }
82
+ }
83
+
84
+ def button_url_link(self, id: str, text: str, url: str) -> Dict:
85
+ """
86
+ Creates an inline button that opens a given URL when clicked.
87
+
88
+ Args:
89
+ id (str): Unique identifier for the button (used for event handling if needed).
90
+ text (str): The text displayed on the button.
91
+ url (str): The destination URL that will be opened when the button is clicked.
92
+
93
+ Returns:
94
+ dict: A dictionary representing the inline button, which can be passed
95
+ to inline keyboard builder methods.
96
+
97
+ Example:
98
+ ```python
99
+ from rubka.button import InlineBuilder
100
+
101
+ buttons = (
102
+ InlineBuilder()
103
+ .row(
104
+ InlineBuilder().button_url_link(
105
+ id="website_btn",
106
+ text="Visit our website 🌐",
107
+ url="https://api-free.ir"
108
+ )
109
+ )
110
+ .build()
111
+ )
112
+
113
+ await message.reply_inline(
114
+ text="Click the button below to visit our website.",
115
+ inline_keypad=buttons
116
+ )
117
+ ```
118
+ """
119
+ return {
120
+ "id": id,
121
+ "type": 'Link',
122
+ "button_text": text,
123
+ "button_link": {
124
+ "type": 'url',
125
+ "link_url": url
126
+ }
127
+ }
19
128
 
20
129
  def button_simple(self, id: str, text: str) -> Dict:
21
130
  return {"id": id, "type": "Simple", "button_text": text}
@@ -8,7 +8,7 @@ except FileNotFoundError:
8
8
 
9
9
  setup(
10
10
  name='Rubka',
11
- version='4.6.2',
11
+ version='5.0.0',
12
12
  description='A Python library for interacting with Rubika Bot API.',
13
13
  long_description=long_description,
14
14
  long_description_content_type='text/markdown',
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