RubigramClient 1.7.17__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.
- rubigram/__init__.py +15 -0
- rubigram/client.py +294 -0
- rubigram/enums/__init__.py +52 -0
- rubigram/enums/buttons/__init__.py +13 -0
- rubigram/enums/buttons/button_calendar_type.py +20 -0
- rubigram/enums/buttons/button_location_type.py +20 -0
- rubigram/enums/buttons/button_selection_get_type.py +20 -0
- rubigram/enums/buttons/button_selection_search_type.py +20 -0
- rubigram/enums/buttons/button_selection_type.py +22 -0
- rubigram/enums/buttons/button_textbox_type_keypad.py +20 -0
- rubigram/enums/buttons/button_textbox_type_line.py +20 -0
- rubigram/enums/buttons/button_type.py +58 -0
- rubigram/enums/chat_action_type.py +22 -0
- rubigram/enums/chat_keypad_type.py +20 -0
- rubigram/enums/chat_type.py +24 -0
- rubigram/enums/enum.py +6 -0
- rubigram/enums/file_type.py +28 -0
- rubigram/enums/forwarded_from_type.py +22 -0
- rubigram/enums/live_location_status.py +20 -0
- rubigram/enums/message_sender_type.py +20 -0
- rubigram/enums/metadata_type.py +18 -0
- rubigram/enums/parse_mode.py +20 -0
- rubigram/enums/payment_status_type.py +20 -0
- rubigram/enums/poll_status_type.py +20 -0
- rubigram/enums/update_endpoint_type.py +26 -0
- rubigram/enums/update_type.py +28 -0
- rubigram/errors.py +16 -0
- rubigram/filters.py +865 -0
- rubigram/http_session.py +96 -0
- rubigram/methods/__init__.py +26 -0
- rubigram/methods/chats/__init__.py +10 -0
- rubigram/methods/chats/get_chat.py +53 -0
- rubigram/methods/decorators/__init__.py +25 -0
- rubigram/methods/decorators/on_inline_message.py +70 -0
- rubigram/methods/decorators/on_message.py +62 -0
- rubigram/methods/decorators/on_remove_message.py +65 -0
- rubigram/methods/decorators/on_start.py +65 -0
- rubigram/methods/decorators/on_started_bot.py +70 -0
- rubigram/methods/decorators/on_stop.py +65 -0
- rubigram/methods/decorators/on_stopped_bot.py +70 -0
- rubigram/methods/decorators/on_update_message.py +70 -0
- rubigram/methods/files/__init__.py +32 -0
- rubigram/methods/files/download_file.py +118 -0
- rubigram/methods/files/get_file.py +41 -0
- rubigram/methods/files/get_file_name.py +41 -0
- rubigram/methods/files/request_send_file.py +49 -0
- rubigram/methods/files/send_file.py +133 -0
- rubigram/methods/files/send_gif.py +51 -0
- rubigram/methods/files/send_music.py +97 -0
- rubigram/methods/files/send_photo.py +95 -0
- rubigram/methods/files/send_video.py +96 -0
- rubigram/methods/files/send_voice.py +96 -0
- rubigram/methods/files/upload_file.py +114 -0
- rubigram/methods/messages/__init__.py +34 -0
- rubigram/methods/messages/delete_messages.py +84 -0
- rubigram/methods/messages/edit_chat_keypad.py +68 -0
- rubigram/methods/messages/edit_message.py +82 -0
- rubigram/methods/messages/edit_message_keypad.py +72 -0
- rubigram/methods/messages/edit_message_text.py +68 -0
- rubigram/methods/messages/forward_message.py +78 -0
- rubigram/methods/messages/remove_chat_keypad.py +46 -0
- rubigram/methods/messages/send_contact.py +114 -0
- rubigram/methods/messages/send_location.py +108 -0
- rubigram/methods/messages/send_message.py +115 -0
- rubigram/methods/messages/send_poll.py +104 -0
- rubigram/methods/messages/send_sticker.py +98 -0
- rubigram/methods/network/__init__.py +12 -0
- rubigram/methods/network/request.py +129 -0
- rubigram/methods/settings/__init__.py +16 -0
- rubigram/methods/settings/set_command.py +50 -0
- rubigram/methods/settings/setup_endpoints.py +48 -0
- rubigram/methods/settings/update_bot_endpoint.py +62 -0
- rubigram/methods/updates/__init__.py +14 -0
- rubigram/methods/updates/get_me.py +35 -0
- rubigram/methods/updates/get_update.py +62 -0
- rubigram/methods/utilities/__init__.py +14 -0
- rubigram/methods/utilities/dispatcher.py +66 -0
- rubigram/methods/utilities/run.py +118 -0
- rubigram/rubino/__init__.py +6 -0
- rubigram/rubino/client.py +374 -0
- rubigram/rubino/network.py +129 -0
- rubigram/server/__init__.py +6 -0
- rubigram/server/server.py +245 -0
- rubigram/state/__init__.py +7 -0
- rubigram/state/state.py +121 -0
- rubigram/state/storage.py +131 -0
- rubigram/types/__init__.py +66 -0
- rubigram/types/aux_data.py +28 -0
- rubigram/types/bot.py +51 -0
- rubigram/types/bot_command.py +26 -0
- rubigram/types/buttons/__init__.py +13 -0
- rubigram/types/buttons/button.py +59 -0
- rubigram/types/buttons/button_calendar.py +40 -0
- rubigram/types/buttons/button_location.py +40 -0
- rubigram/types/buttons/button_number_picker.py +34 -0
- rubigram/types/buttons/button_selection.py +48 -0
- rubigram/types/buttons/button_selection_item.py +32 -0
- rubigram/types/buttons/button_string_picker.py +29 -0
- rubigram/types/buttons/button_text_box.py +40 -0
- rubigram/types/chat.py +86 -0
- rubigram/types/config/__init__.py +6 -0
- rubigram/types/config/object.py +442 -0
- rubigram/types/contact_message.py +29 -0
- rubigram/types/file.py +78 -0
- rubigram/types/forwarded_from.py +39 -0
- rubigram/types/keypads/__init__.py +7 -0
- rubigram/types/keypads/keypad.py +31 -0
- rubigram/types/keypads/keypad_row.py +23 -0
- rubigram/types/live_location.py +44 -0
- rubigram/types/location.py +24 -0
- rubigram/types/messages/__init__.py +8 -0
- rubigram/types/messages/inline_message.py +78 -0
- rubigram/types/messages/message.py +117 -0
- rubigram/types/messages/update_message.py +341 -0
- rubigram/types/metadata/__init__.py +7 -0
- rubigram/types/metadata/metadata.py +43 -0
- rubigram/types/metadata/metadata_parts.py +42 -0
- rubigram/types/payment_status.py +30 -0
- rubigram/types/poll.py +32 -0
- rubigram/types/poll_status.py +40 -0
- rubigram/types/sticker.py +33 -0
- rubigram/types/updates/__init__.py +7 -0
- rubigram/types/updates/update.py +917 -0
- rubigram/types/updates/updates.py +56 -0
- rubigram/utils/__init__.py +14 -0
- rubigram/utils/auto_delete.py +93 -0
- rubigram/utils/parser.py +99 -0
- rubigramclient-1.7.17.dist-info/METADATA +215 -0
- rubigramclient-1.7.17.dist-info/RECORD +132 -0
- rubigramclient-1.7.17.dist-info/WHEEL +5 -0
- rubigramclient-1.7.17.dist-info/licenses/LICENSE +21 -0
- rubigramclient-1.7.17.dist-info/top_level.txt +1 -0
rubigram/__init__.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from . import errors, enums, types, filters
|
|
7
|
+
from .state import State, Storage
|
|
8
|
+
from .client import Client
|
|
9
|
+
from .server import Server
|
|
10
|
+
from .rubino import Rubino
|
|
11
|
+
|
|
12
|
+
__version__ = "1.7.17"
|
|
13
|
+
__author__ = "PyJavad"
|
|
14
|
+
__github__ = "https://github.ocm/DevJavad/rubigram"
|
|
15
|
+
__message__ = "Welcome to Rubigram Client\nYou are using version %s", __version__
|
rubigram/client.py
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Optional, Callable, Union
|
|
8
|
+
from .enums import ParseMode
|
|
9
|
+
from .methods import Methods
|
|
10
|
+
from .state import Storage, State
|
|
11
|
+
from .http_session import HttpSession
|
|
12
|
+
import logging
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Client(Methods):
|
|
19
|
+
"""
|
|
20
|
+
Main client class for interacting with the Rubika Bot API.
|
|
21
|
+
|
|
22
|
+
This class extends Methods to provide API functionality and manages
|
|
23
|
+
the bot's lifecycle, webhook configuration, message handlers, and
|
|
24
|
+
connection settings.
|
|
25
|
+
|
|
26
|
+
Parameters:
|
|
27
|
+
token (str):
|
|
28
|
+
Bot token obtained from @RubikaBot.
|
|
29
|
+
|
|
30
|
+
webhook (Optional[str], optional):
|
|
31
|
+
Webhook URL for receiving updates. If None, long polling is used.
|
|
32
|
+
Defaults to None.
|
|
33
|
+
|
|
34
|
+
parse_mode (Union[str, "ParseMode"], optional):
|
|
35
|
+
Default parse mode for text messages. Can be "markdown", "html",
|
|
36
|
+
or a ParseMode enum value. Defaults to "markdown".
|
|
37
|
+
|
|
38
|
+
storage (Optional["Storage"], optional):
|
|
39
|
+
Storage instance for persisting user states and data.
|
|
40
|
+
If None, a new Storage instance is created. Defaults to None.
|
|
41
|
+
|
|
42
|
+
proxy (Optional[str], optional):
|
|
43
|
+
Proxy URL for HTTP requests (e.g., "http://proxy.com:8080").
|
|
44
|
+
Defaults to None.
|
|
45
|
+
|
|
46
|
+
retries (int, optional):
|
|
47
|
+
Number of retries for failed HTTP requests. Defaults to 3.
|
|
48
|
+
|
|
49
|
+
delay (float, optional):
|
|
50
|
+
Initial delay between retries in seconds. Defaults to 1.0.
|
|
51
|
+
|
|
52
|
+
backoff (int, optional):
|
|
53
|
+
Exponential backoff multiplier for retries. Defaults to 2.
|
|
54
|
+
|
|
55
|
+
timeout (float, optional):
|
|
56
|
+
Total timeout for HTTP requests in seconds. Defaults to 100.0.
|
|
57
|
+
|
|
58
|
+
connect_timeout (float, optional):
|
|
59
|
+
Connection establishment timeout in seconds. Defaults to 30.0.
|
|
60
|
+
|
|
61
|
+
read_timeout (float, optional):
|
|
62
|
+
Socket read timeout in seconds. Defaults to 50.0.
|
|
63
|
+
|
|
64
|
+
max_connections (int, optional):
|
|
65
|
+
Maximum number of simultaneous HTTP connections. Defaults to 100.
|
|
66
|
+
|
|
67
|
+
Attributes:
|
|
68
|
+
token (str): Bot authentication token.
|
|
69
|
+
webhook (Optional[str]): Configured webhook URL.
|
|
70
|
+
parse_mode (Union[str, ParseMode]): Default parse mode.
|
|
71
|
+
storage (Storage): User state storage instance.
|
|
72
|
+
proxy (Optional[str]): Proxy URL for requests.
|
|
73
|
+
retries (int): Number of retry attempts.
|
|
74
|
+
delay (float): Initial retry delay.
|
|
75
|
+
backoff (int): Retry backoff multiplier.
|
|
76
|
+
http (HttpSession): HTTP session manager.
|
|
77
|
+
offset_id (Union[str, None]): Last processed update ID for polling.
|
|
78
|
+
set_new_endpoint (bool): Flag to configure endpoints on startup.
|
|
79
|
+
api (str): Base API endpoint URL.
|
|
80
|
+
new_message_handlers (list[Callable]): Handlers for new messages.
|
|
81
|
+
inline_message_handlers (list[Callable]): Handlers for inline queries.
|
|
82
|
+
update_message_handlers (list[Callable]): Handlers for message updates.
|
|
83
|
+
remove_message_handlers (list[Callable]): Handlers for message deletions.
|
|
84
|
+
started_bot_handlers (list[Callable]): Handlers for bot start events.
|
|
85
|
+
stopped_bot_handlers (list[Callable]): Handlers for bot stop events.
|
|
86
|
+
start_handlers (list[Callable]): Handlers for client start.
|
|
87
|
+
stop_handlers (list[Callable]): Handlers for client stop.
|
|
88
|
+
router_handlers (list[Callable]): Handlers for routing updates.
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
.. code-block:: python
|
|
92
|
+
# Basic client
|
|
93
|
+
client = Client(token="YOUR_BOT_TOKEN")
|
|
94
|
+
|
|
95
|
+
# Client with webhook
|
|
96
|
+
client = Client(
|
|
97
|
+
token="YOUR_BOT_TOKEN",
|
|
98
|
+
webhook="https://example.com/webhook",
|
|
99
|
+
parse_mode="html",
|
|
100
|
+
retries=5
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Client with storage and proxy
|
|
104
|
+
storage = Storage()
|
|
105
|
+
client = Client(
|
|
106
|
+
token="YOUR_BOT_TOKEN",
|
|
107
|
+
storage=storage,
|
|
108
|
+
proxy="http://proxy:8080"
|
|
109
|
+
)
|
|
110
|
+
"""
|
|
111
|
+
|
|
112
|
+
def __init__(
|
|
113
|
+
self,
|
|
114
|
+
token: str,
|
|
115
|
+
webhook: Optional[str] = None,
|
|
116
|
+
parse_mode: Union[str, ParseMode] = ParseMode.MARKDOWN,
|
|
117
|
+
storage: Optional[Storage] = None,
|
|
118
|
+
proxy: Optional[str] = None,
|
|
119
|
+
retries: int = 3,
|
|
120
|
+
delay: float = 1.0,
|
|
121
|
+
backoff: int = 2,
|
|
122
|
+
max_delay: float = 5.0,
|
|
123
|
+
timeout: float = 100.0,
|
|
124
|
+
connect_timeout: float = 30.0,
|
|
125
|
+
read_timeout: float = 50.0,
|
|
126
|
+
max_connections: int = 100,
|
|
127
|
+
offset_id: Optional[str] = None
|
|
128
|
+
):
|
|
129
|
+
self.token = token
|
|
130
|
+
self.webhook = webhook
|
|
131
|
+
self.parse_mode = parse_mode
|
|
132
|
+
self.storage = storage or Storage()
|
|
133
|
+
self.proxy = proxy
|
|
134
|
+
self.retries = retries
|
|
135
|
+
self.delay = delay
|
|
136
|
+
self.backoff = backoff
|
|
137
|
+
self.max_delay = max_delay
|
|
138
|
+
self.offset_id = offset_id
|
|
139
|
+
self.http = HttpSession(
|
|
140
|
+
timeout, connect_timeout, read_timeout, max_connections
|
|
141
|
+
)
|
|
142
|
+
|
|
143
|
+
self.set_new_endpoint: bool = True
|
|
144
|
+
self.api: str = f"https://botapi.rubika.ir/v3/{token}/"
|
|
145
|
+
|
|
146
|
+
self.new_message_handlers: list[Callable] = []
|
|
147
|
+
self.inline_message_handlers: list[Callable] = []
|
|
148
|
+
self.update_message_handlers: list[Callable] = []
|
|
149
|
+
self.remove_message_handlers: list[Callable] = []
|
|
150
|
+
self.started_bot_handlers: list[Callable] = []
|
|
151
|
+
self.stopped_bot_handlers: list[Callable] = []
|
|
152
|
+
self.start_handlers: list[Callable] = []
|
|
153
|
+
self.stop_handlers: list[Callable] = []
|
|
154
|
+
self.router_handlers: list[Callable] = []
|
|
155
|
+
|
|
156
|
+
super().__init__()
|
|
157
|
+
|
|
158
|
+
def state(self, user_id: str):
|
|
159
|
+
"""
|
|
160
|
+
Get a State object for managing user conversation state.
|
|
161
|
+
|
|
162
|
+
Parameters:
|
|
163
|
+
user_id (str):
|
|
164
|
+
Unique identifier for the user (chat_id).
|
|
165
|
+
|
|
166
|
+
Returns:
|
|
167
|
+
State: A State instance bound to the specified user.
|
|
168
|
+
|
|
169
|
+
Example:
|
|
170
|
+
.. code-block:: python
|
|
171
|
+
user_state = client.state("b0123456789")
|
|
172
|
+
await user_state.update({"step": "waiting_for_name"})
|
|
173
|
+
data = await user_state.get()
|
|
174
|
+
"""
|
|
175
|
+
return State(self.storage, user_id)
|
|
176
|
+
|
|
177
|
+
async def start(self):
|
|
178
|
+
"""
|
|
179
|
+
Start the client and establish HTTP connections.
|
|
180
|
+
|
|
181
|
+
This method:
|
|
182
|
+
1. Connects the HTTP session
|
|
183
|
+
2. Executes all registered start handlers
|
|
184
|
+
3. Logs any handler errors
|
|
185
|
+
|
|
186
|
+
Note:
|
|
187
|
+
Called automatically when using context manager or startup().
|
|
188
|
+
|
|
189
|
+
Example:
|
|
190
|
+
.. code-block:: python
|
|
191
|
+
await client.start()
|
|
192
|
+
"""
|
|
193
|
+
await self.http.connect()
|
|
194
|
+
for app in self.start_handlers:
|
|
195
|
+
try:
|
|
196
|
+
await app(self)
|
|
197
|
+
except Exception as error:
|
|
198
|
+
logger.warning("Start app, error=%s", error)
|
|
199
|
+
|
|
200
|
+
async def stop(self):
|
|
201
|
+
"""
|
|
202
|
+
Stop the client and close HTTP connections.
|
|
203
|
+
|
|
204
|
+
This method:
|
|
205
|
+
1. Executes all registered stop handlers
|
|
206
|
+
2. Disconnects the HTTP session
|
|
207
|
+
3. Logs any handler errors
|
|
208
|
+
|
|
209
|
+
Note:
|
|
210
|
+
Called automatically when using context manager or cleanup().
|
|
211
|
+
|
|
212
|
+
Example:
|
|
213
|
+
.. code-block:: python
|
|
214
|
+
await client.stop()
|
|
215
|
+
"""
|
|
216
|
+
await self.http.disconnect()
|
|
217
|
+
for app in self.stop_handlers:
|
|
218
|
+
try:
|
|
219
|
+
await app(self)
|
|
220
|
+
except Exception as error:
|
|
221
|
+
logger.warning("Stop app, error=%s", error)
|
|
222
|
+
|
|
223
|
+
async def startup(self, app):
|
|
224
|
+
"""
|
|
225
|
+
Start the client and configure endpoints if needed.
|
|
226
|
+
|
|
227
|
+
Parameters:
|
|
228
|
+
app:
|
|
229
|
+
Application context (typically from a web framework).
|
|
230
|
+
|
|
231
|
+
Note:
|
|
232
|
+
This method is designed to be used with web frameworks
|
|
233
|
+
like FastAPI or Quart that have startup events.
|
|
234
|
+
|
|
235
|
+
Example:
|
|
236
|
+
.. code-block:: python
|
|
237
|
+
# In FastAPI
|
|
238
|
+
@app.on_event("startup")
|
|
239
|
+
async def startup_event():
|
|
240
|
+
await client.startup(app)
|
|
241
|
+
"""
|
|
242
|
+
await self.start()
|
|
243
|
+
if self.set_new_endpoint:
|
|
244
|
+
await self.setup_endpoints()
|
|
245
|
+
|
|
246
|
+
async def cleanup(self, app):
|
|
247
|
+
"""
|
|
248
|
+
Stop the client during application cleanup.
|
|
249
|
+
|
|
250
|
+
Parameters:
|
|
251
|
+
app:
|
|
252
|
+
Application context (typically from a web framework).
|
|
253
|
+
|
|
254
|
+
Note:
|
|
255
|
+
This method is designed to be used with web frameworks
|
|
256
|
+
like FastAPI or Quart that have shutdown events.
|
|
257
|
+
|
|
258
|
+
Example:
|
|
259
|
+
.. code-block:: python
|
|
260
|
+
# In FastAPI
|
|
261
|
+
@app.on_event("shutdown")
|
|
262
|
+
async def shutdown_event():
|
|
263
|
+
await client.cleanup(app)
|
|
264
|
+
"""
|
|
265
|
+
await self.stop()
|
|
266
|
+
|
|
267
|
+
async def __aenter__(self):
|
|
268
|
+
"""
|
|
269
|
+
Enter the async context manager.
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
Client: The started client instance.
|
|
273
|
+
|
|
274
|
+
Example:
|
|
275
|
+
.. code-block:: python
|
|
276
|
+
async with Client(token="YOUR_TOKEN") as client:
|
|
277
|
+
# Client is started here
|
|
278
|
+
await client.send_message(...)
|
|
279
|
+
# Client is automatically stopped here
|
|
280
|
+
"""
|
|
281
|
+
await self.start()
|
|
282
|
+
return self
|
|
283
|
+
|
|
284
|
+
async def __aexit__(self, *args):
|
|
285
|
+
"""
|
|
286
|
+
Exit the async context manager.
|
|
287
|
+
|
|
288
|
+
Parameters:
|
|
289
|
+
*args: Exception information if an exception occurred.
|
|
290
|
+
|
|
291
|
+
Note:
|
|
292
|
+
Always stops the client, even if an exception occurred.
|
|
293
|
+
"""
|
|
294
|
+
await self.stop()
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from .buttons import (
|
|
7
|
+
ButtonCalendarType,
|
|
8
|
+
ButtonLocationType,
|
|
9
|
+
ButtonSelectionGetType,
|
|
10
|
+
ButtonSelectionSearchType,
|
|
11
|
+
ButtonSelectionType,
|
|
12
|
+
ButtonTextboxTypeLine,
|
|
13
|
+
ButtonTextboxTypeKeypad,
|
|
14
|
+
ButtonType
|
|
15
|
+
)
|
|
16
|
+
from .chat_action_type import ChatActionType
|
|
17
|
+
from .chat_keypad_type import ChatKeypadType
|
|
18
|
+
from .chat_type import ChatType
|
|
19
|
+
from .file_type import FileType
|
|
20
|
+
from .forwarded_from_type import ForwardedFromType
|
|
21
|
+
from .live_location_status import LiveLocationStatus
|
|
22
|
+
from .message_sender_type import MessageSenderType
|
|
23
|
+
from .parse_mode import ParseMode
|
|
24
|
+
from .payment_status_type import PaymentStatusType
|
|
25
|
+
from .poll_status_type import PollStatusType
|
|
26
|
+
from .update_endpoint_type import UpdateEndpointType
|
|
27
|
+
from .update_type import UpdateType
|
|
28
|
+
from .metadata_type import MetadataType
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"ButtonCalendarType",
|
|
32
|
+
"ButtonLocationType",
|
|
33
|
+
"ButtonSelectionGetType",
|
|
34
|
+
"ButtonSelectionSearchType",
|
|
35
|
+
"ButtonSelectionType",
|
|
36
|
+
"ButtonTextboxTypeLine",
|
|
37
|
+
"ButtonTextboxTypeKeypad",
|
|
38
|
+
"ButtonType",
|
|
39
|
+
"ChatActionType",
|
|
40
|
+
"ChatKeypadType",
|
|
41
|
+
"ChatType",
|
|
42
|
+
"FileType",
|
|
43
|
+
"ForwardedFromType",
|
|
44
|
+
"LiveLocationStatus",
|
|
45
|
+
"MessageSenderType",
|
|
46
|
+
"ParseMode",
|
|
47
|
+
"PaymentStatusType",
|
|
48
|
+
"PollStatusType",
|
|
49
|
+
"UpdateEndpointType",
|
|
50
|
+
"UpdateType",
|
|
51
|
+
"MetadataType"
|
|
52
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from .button_calendar_type import ButtonCalendarType
|
|
7
|
+
from .button_location_type import ButtonLocationType
|
|
8
|
+
from .button_selection_get_type import ButtonSelectionGetType
|
|
9
|
+
from .button_selection_search_type import ButtonSelectionSearchType
|
|
10
|
+
from .button_selection_type import ButtonSelectionType
|
|
11
|
+
from .button_textbox_type_line import ButtonTextboxTypeLine
|
|
12
|
+
from .button_textbox_type_keypad import ButtonTextboxTypeKeypad
|
|
13
|
+
from .button_type import ButtonType
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonCalendarType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the calendar types available for calendar buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonCalendarType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
DATE_PERSIAN (str): Persian (Jalali) calendar type.
|
|
16
|
+
DATE_GREGORIAN (str): Gregorian calendar type.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
DATE_PERSIAN = "DatePersian"
|
|
20
|
+
DATE_GREGORIAN = "DateGregorian"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonLocationType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the types of location buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonLocationType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
PICKER (str): A button to pick a location.
|
|
16
|
+
VIEW (str): A button to view a location.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
PICKER = "Picker"
|
|
20
|
+
VIEW = "View"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonSelectionGetType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the methods available to retrieve selection button data.**
|
|
12
|
+
`from rubigram.enums import ButtonSelectionGetType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
LOCAL (str): Retrieve data locally.
|
|
16
|
+
API (str): Retrieve data via API.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
LOCAL = "Local"
|
|
20
|
+
API = "Api"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonSelectionSearchType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the search modes available for selection buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonSelectionSearchType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
LOCAL (str): Search is performed locally.
|
|
16
|
+
API (str): Search is performed via API.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
LOCAL = "Local"
|
|
20
|
+
API = "Api"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonSelectionType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the different styles of selection buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonSelectionType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
TEXT_ONLY (str): A selection button with text only.
|
|
16
|
+
TEXT_IMG_THU (str): A selection button with text and a thumbnail image.
|
|
17
|
+
TEXT_IMG_BIG (str): A selection button with text and a large image.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
TEXT_ONLY = "TextOnly"
|
|
21
|
+
TEXT_IMG_THU = "TextImgThu"
|
|
22
|
+
TEXT_IMG_BIG = "TextImgBig"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonTextboxTypeKeypad(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the keypad types available for textbox buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonTextboxTypeKeypad`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
STRING (str): Textbox accepts string input.
|
|
16
|
+
NUMBER (str): Textbox accepts numeric input.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
STRING = "String"
|
|
20
|
+
NUMBER = "Number"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonTextboxTypeLine(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the line types available for textbox buttons.**
|
|
12
|
+
`from rubigram.enums import ButtonTextboxTypeLine`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
SINGLE_LINE (str): Textbox is a single-line input.
|
|
16
|
+
MULTI_LINE (str): Textbox allows multiple lines.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
SINGLE_LINE = "SingleLine"
|
|
20
|
+
MULTI_LINE = "MultiLine"
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from ..enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ButtonType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the different types of interactive buttons available in a chat.**
|
|
12
|
+
`from rubigram.enums import ButtonType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
SIMPLE (str): A simple button.
|
|
16
|
+
SELECTION (str): A selection button.
|
|
17
|
+
CALENDAR (str): A calendar picker button.
|
|
18
|
+
NUMBER_PICKER (str): A number picker button.
|
|
19
|
+
STRING_PICKER (str): A string picker button.
|
|
20
|
+
LOCATION (str): A button to share location.
|
|
21
|
+
PAYMENT (str): A payment button.
|
|
22
|
+
CAMERA_IMAGE (str): A button to capture an image via camera.
|
|
23
|
+
CAMERA_VIDEO (str): A button to record a video via camera.
|
|
24
|
+
GALLERY_IMAGE (str): A button to select an image from gallery.
|
|
25
|
+
GALLERY_VIDEO (str): A button to select a video from gallery.
|
|
26
|
+
FILE (str): A button to send a file.
|
|
27
|
+
AUDIO (str): A button to send an audio file.
|
|
28
|
+
RECORD_AUDIO (str): A button to record audio.
|
|
29
|
+
MY_PHONE_NUMBER (str): A button to share the user's phone number.
|
|
30
|
+
MY_LOCATION (str): A button to share the user's location.
|
|
31
|
+
TEXTBOX (str): A textbox input button.
|
|
32
|
+
LINK (str): A button containing a link.
|
|
33
|
+
ASK_MY_PHONE_NUMBER (str): A button that requests the user's phone number.
|
|
34
|
+
ASK_LOCATION (str): A button that requests the user's location.
|
|
35
|
+
BARCODE (str): A button to scan a barcode.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
SIMPLE = "Simple"
|
|
39
|
+
SELECTION = "Selection"
|
|
40
|
+
CALENDAR = "Calendar"
|
|
41
|
+
NUMBER_PICKER = "NumberPicker"
|
|
42
|
+
STRING_PICKER = "StringPicker"
|
|
43
|
+
LOCATION = "Location"
|
|
44
|
+
PAYMENT = "Payment"
|
|
45
|
+
CAMERA_IMAGE = "CameraImage"
|
|
46
|
+
CAMERA_VIDEO = "CameraVideo"
|
|
47
|
+
GALLERY_IMAGE = "GalleryImage"
|
|
48
|
+
GALLERY_VIDEO = "GalleryVideo"
|
|
49
|
+
FILE = "File"
|
|
50
|
+
AUDIO = "Audio"
|
|
51
|
+
RECORD_AUDIO = "RecordAudio"
|
|
52
|
+
MY_PHONE_NUMBER = "MyPhoneNumber"
|
|
53
|
+
MY_LOCATION = "MyLocation"
|
|
54
|
+
TEXTBOX = "Textbox"
|
|
55
|
+
LINK = "Link"
|
|
56
|
+
ASK_MY_PHONE_NUMBER = "AskMyPhoneNumber"
|
|
57
|
+
ASK_LOCATION = "AskLocation"
|
|
58
|
+
BARCODE = "Barcode"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from .enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ChatActionType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the types of actions a user can perform in a chat.**
|
|
12
|
+
`from rubigram.enums import ChatActionType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
TYPING (str): Indicates the user is typing a message.
|
|
16
|
+
UPLOADING (str): Indicates the user is uploading a file.
|
|
17
|
+
RECORDING (str): Indicates the user is recording a voice message.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
TYPING = "Typing"
|
|
21
|
+
UPLOADING = "Uploading"
|
|
22
|
+
RECORDING = "Recording"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from .enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ChatKeypadType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents the types of keypads that can be applied to a chat.**
|
|
12
|
+
`from rubigram.enums import ChatKeypadType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
New (str): Creates and applies a new keypad to the chat.
|
|
16
|
+
Remove (str): Removes the existing keypad from the chat.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
NEW = "New"
|
|
20
|
+
REMOVE = "Remove"
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# RubigramClient - Rubika API library for python
|
|
2
|
+
# Copyright (C) 2025-present Javad <https://github.com/DevJavad>
|
|
3
|
+
# Github - https://github.com/DevJavad/rubigram
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
from .enum import Enum
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ChatType(Enum):
|
|
10
|
+
"""
|
|
11
|
+
**Represents different types of chats.**
|
|
12
|
+
`from rubigram.enums import ChatType`
|
|
13
|
+
|
|
14
|
+
Attributes:
|
|
15
|
+
User: Standard private chat with a user.
|
|
16
|
+
Bot: Chat with an automated bot.
|
|
17
|
+
Group: Multi-user group conversation.
|
|
18
|
+
Channel: One-way broadcast chat.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
USER = "User"
|
|
22
|
+
BOT = "Bot"
|
|
23
|
+
GROUP = "Group"
|
|
24
|
+
CHANNEL = "Channel"
|