RubigramClient 1.7.0__py3-none-any.whl → 1.7.2__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.

Potentially problematic release.


This version of RubigramClient might be problematic. Click here for more details.

Files changed (74) hide show
  1. rubigram/__init__.py +1 -5
  2. rubigram/client.py +102 -154
  3. rubigram/enums.py +4 -3
  4. rubigram/filters.py +600 -139
  5. rubigram/handler.py +24 -0
  6. rubigram/http.py +32 -0
  7. rubigram/logger.py +20 -0
  8. rubigram/method/__init__.py +18 -0
  9. rubigram/method/chat/__init__.py +10 -0
  10. rubigram/method/chat/get_chat.py +26 -0
  11. rubigram/method/chat/get_me.py +22 -0
  12. rubigram/method/chat/get_update.py +32 -0
  13. rubigram/method/decorator/__init__.py +8 -0
  14. rubigram/method/decorator/on_delete_message.py +37 -0
  15. rubigram/method/decorator/on_edit_message.py +37 -0
  16. rubigram/method/decorator/on_inline_message.py +40 -0
  17. rubigram/method/decorator/on_message.py +38 -0
  18. rubigram/method/decorator/on_start.py +30 -0
  19. rubigram/method/decorator/on_stop.py +29 -0
  20. rubigram/method/decorator/register.py +43 -0
  21. rubigram/method/file/__init__.py +32 -0
  22. rubigram/method/file/download_file.py +34 -0
  23. rubigram/method/file/get_bytes.py +25 -0
  24. rubigram/method/file/get_file.py +27 -0
  25. rubigram/method/file/get_file_name.py +29 -0
  26. rubigram/method/file/request_download_file.py +35 -0
  27. rubigram/method/file/request_send_file.py +28 -0
  28. rubigram/method/file/request_upload_file.py +62 -0
  29. rubigram/method/file/send_document.py +58 -0
  30. rubigram/method/file/send_file.py +78 -0
  31. rubigram/method/file/send_gif.py +58 -0
  32. rubigram/method/file/send_music.py +58 -0
  33. rubigram/method/file/send_photo.py +58 -0
  34. rubigram/method/file/send_video.py +58 -0
  35. rubigram/method/file/send_voice.py +55 -0
  36. rubigram/method/messages/__init__.py +29 -0
  37. rubigram/method/messages/delete_message.py +50 -0
  38. rubigram/method/messages/edit_chat_keypad.py +34 -0
  39. rubigram/method/messages/edit_message.py +41 -0
  40. rubigram/method/messages/edit_message_keypad.py +38 -0
  41. rubigram/method/messages/edit_message_text.py +34 -0
  42. rubigram/method/messages/forward_message.py +43 -0
  43. rubigram/method/messages/remove_chat_keypad.py +28 -0
  44. rubigram/method/messages/send_contact.py +74 -0
  45. rubigram/method/messages/send_location.py +70 -0
  46. rubigram/method/messages/send_message.py +67 -0
  47. rubigram/method/messages/send_poll.py +71 -0
  48. rubigram/method/messages/send_sticker.py +66 -0
  49. rubigram/method/network/__init__.py +7 -0
  50. rubigram/method/network/request.py +20 -0
  51. rubigram/method/setting/__init__.py +9 -0
  52. rubigram/method/setting/set_command.py +32 -0
  53. rubigram/method/setting/update_bot_endpoint.py +31 -0
  54. rubigram/method/utilities/__init__.py +11 -0
  55. rubigram/method/utilities/dispatch.py +25 -0
  56. rubigram/method/utilities/setup_endpoint.py +16 -0
  57. rubigram/method/utilities/updater.py +17 -0
  58. rubigram/state.py +14 -19
  59. rubigram/types/__init__.py +3 -0
  60. rubigram/types/messages.py +175 -0
  61. rubigram/types/object.py +112 -0
  62. rubigram/types/types.py +211 -0
  63. rubigram/types/updates.py +572 -0
  64. {rubigramclient-1.7.0.dist-info → rubigramclient-1.7.2.dist-info}/METADATA +12 -8
  65. rubigramclient-1.7.2.dist-info/RECORD +68 -0
  66. rubigram/method.py +0 -354
  67. rubigram/network.py +0 -80
  68. rubigram/rubino/__init__.py +0 -1
  69. rubigram/rubino/client.py +0 -480
  70. rubigram/types.py +0 -538
  71. rubigramclient-1.7.0.dist-info/RECORD +0 -15
  72. {rubigramclient-1.7.0.dist-info → rubigramclient-1.7.2.dist-info}/WHEEL +0 -0
  73. {rubigramclient-1.7.0.dist-info → rubigramclient-1.7.2.dist-info}/licenses/LICENSE +0 -0
  74. {rubigramclient-1.7.0.dist-info → rubigramclient-1.7.2.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,572 @@
1
+ from typing import Optional
2
+ from dataclasses import dataclass
3
+ from .object import Object
4
+ from .types import *
5
+ import rubigram
6
+
7
+
8
+ @dataclass
9
+ class Update(Object):
10
+ type: Optional[enums.UpdateType] = None
11
+ chat_id: Optional[str] = None
12
+ removed_message_id: Optional[str] = None
13
+ new_message: Optional["rubigram.types.Message"] = None
14
+ updated_message: Optional["rubigram.types.Message"] = None
15
+ updated_payment: Optional["rubigram.types.PaymentStatus"] = None
16
+ client: Optional["rubigram.Client"] = None
17
+
18
+ async def reply(
19
+ self,
20
+ text: str,
21
+ chat_keypad: Optional[Keypad] = None,
22
+ inline_keypad: Optional[Keypad] = None,
23
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
24
+ disable_notification: Optional[bool] = None,
25
+ ) -> "rubigram.types.UMessage":
26
+ """Reply to the current message with text and optional keypads.
27
+
28
+ Args:
29
+ text (str): The text of the reply message.
30
+ chat_keypad (Optional[Keypad], optional): Keypad to show in the chat. Defaults to None.
31
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
32
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
33
+ disable_notification (Optional[bool], optional): If True, disables notification for the message. Defaults to None.
34
+
35
+ Returns:
36
+ rubigram.types.UMessage: The sent reply message object.
37
+
38
+ Example:
39
+ >>> reply_msg = await update.reply("Hello!", chat_keypad=my_keypad)
40
+ """
41
+ return await self.client.send_message(
42
+ self.chat_id,
43
+ text,
44
+ chat_keypad,
45
+ inline_keypad,
46
+ chat_keypad_type,
47
+ disable_notification,
48
+ self.new_message.message_id if self.new_message else None,
49
+ )
50
+
51
+ async def reply_poll(
52
+ self,
53
+ question: str,
54
+ options: list[str],
55
+ chat_keypad: Optional[Keypad] = None,
56
+ inline_keypad: Optional[Keypad] = None,
57
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
58
+ disable_notification: bool = False,
59
+ ) -> "rubigram.types.UMessage":
60
+ """Reply to the current message with a poll.
61
+
62
+ Args:
63
+ question (str): The poll question text.
64
+ options (list[str]): A list of options for the poll.
65
+ chat_keypad (Optional[Keypad], optional): Keypad to show in the chat. Defaults to None.
66
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
67
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
68
+ disable_notification (bool, optional): If True, disables notification for the message. Defaults to False.
69
+
70
+ Returns:
71
+ rubigram.types.UMessage: The sent poll message object.
72
+
73
+ Example:
74
+ >>> poll_msg = await update.reply_poll(
75
+ >>> "What's your favorite color?",
76
+ >>> ["Red", "Blue", "Green"]
77
+ >>> )
78
+ """
79
+ return await self.client.send_poll(
80
+ self.chat_id,
81
+ question,
82
+ options,
83
+ chat_keypad,
84
+ inline_keypad,
85
+ chat_keypad_type,
86
+ disable_notification,
87
+ self.new_message.message_id if self.new_message else None,
88
+ )
89
+
90
+ async def reply_location(
91
+ self,
92
+ latitude: str,
93
+ longitude: str,
94
+ chat_keypad: Optional[Keypad] = None,
95
+ inline_keypad: Optional[Keypad] = None,
96
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
97
+ disable_notification: bool = False,
98
+ ) -> "rubigram.types.UMessage":
99
+ """Reply to the current message with a location.
100
+
101
+ Args:
102
+ latitude (str): Latitude of the location.
103
+ longitude (str): Longitude of the location.
104
+ chat_keypad (Optional[Keypad], optional): Keypad to show in chat. Defaults to None.
105
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
106
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
107
+ disable_notification (bool, optional): If True, disables notification. Defaults to False.
108
+
109
+ Returns:
110
+ rubigram.types.UMessage: The sent location message.
111
+
112
+ Example:
113
+ >>> await update.reply_location("35.6895", "139.6917")
114
+ """
115
+ return await self.client.send_location(
116
+ self.chat_id,
117
+ latitude,
118
+ longitude,
119
+ chat_keypad,
120
+ inline_keypad,
121
+ chat_keypad_type,
122
+ disable_notification,
123
+ self.new_message.message_id if self.new_message else None,
124
+ )
125
+
126
+ async def reply_contact(
127
+ self,
128
+ first_name: str,
129
+ last_name: str,
130
+ phone_number: str,
131
+ chat_keypad: Optional[Keypad] = None,
132
+ inline_keypad: Optional[Keypad] = None,
133
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
134
+ disable_notification: bool = False,
135
+ ) -> "rubigram.types.UMessage":
136
+ """Reply to the current message with a contact.
137
+
138
+ Args:
139
+ first_name (str): Contact's first name.
140
+ last_name (str): Contact's last name.
141
+ phone_number (str): Contact's phone number.
142
+ chat_keypad (Optional[Keypad], optional): Keypad to show in chat. Defaults to None.
143
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
144
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
145
+ disable_notification (bool, optional): If True, disables notification. Defaults to False.
146
+
147
+ Returns:
148
+ rubigram.types.UMessage: The sent contact message.
149
+
150
+ Example:
151
+ >>> await update.reply_contact("John", "Doe", "+123456789")
152
+ """
153
+ return await self.client.send_contact(
154
+ self.chat_id,
155
+ first_name,
156
+ last_name,
157
+ phone_number,
158
+ chat_keypad,
159
+ inline_keypad,
160
+ chat_keypad_type,
161
+ disable_notification,
162
+ self.new_message.message_id if self.new_message else None,
163
+ )
164
+
165
+ async def reply_sticker(
166
+ self,
167
+ sticker_id: str,
168
+ chat_keypad: Optional[Keypad] = None,
169
+ inline_keypad: Optional[Keypad] = None,
170
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
171
+ disable_notification: bool = False,
172
+ ) -> "rubigram.types.UMessage":
173
+ """Reply to the current message with a sticker.
174
+
175
+ Args:
176
+ sticker_id (str): The ID of the sticker to send.
177
+ chat_keypad (Optional[Keypad], optional): Keypad to show in chat. Defaults to None.
178
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
179
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
180
+ disable_notification (bool, optional): If True, disables notification. Defaults to False.
181
+
182
+ Returns:
183
+ rubigram.types.UMessage: The sent sticker message.
184
+
185
+ Example:
186
+ >>> await update.reply_sticker("CAADAgADQAADyIsGAAE7MpzFPFQXkQI")
187
+ """
188
+ return await self.client.send_message(
189
+ self.chat_id,
190
+ sticker_id,
191
+ chat_keypad,
192
+ inline_keypad,
193
+ chat_keypad_type,
194
+ disable_notification,
195
+ self.new_message.message_id if self.new_message else None,
196
+ )
197
+
198
+ async def reply_file(
199
+ self,
200
+ file: Union[str, bytes],
201
+ caption: Optional[str] = None,
202
+ file_name: Optional[str] = None,
203
+ type: Optional[Union[str, enums.FileType]] = enums.FileType.File,
204
+ chat_keypad: Optional[Keypad] = None,
205
+ inline_keypad: Optional[Keypad] = None,
206
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
207
+ disable_notification: bool = False,
208
+ ) -> "rubigram.types.UMessage":
209
+ """Reply to the current message with a file.
210
+
211
+ Args:
212
+ file (Union[str, bytes]): The file path or binary data to send.
213
+ caption (Optional[str], optional): Caption for the file. Defaults to None.
214
+ file_name (Optional[str], optional): Custom filename for the file. Defaults to None.
215
+ type (enums.FileType, optional): Type of the file (File, Document, etc.). Defaults to File.
216
+ chat_keypad (Optional[Keypad], optional): Keypad to show in chat. Defaults to None.
217
+ inline_keypad (Optional[Keypad], optional): Inline keypad to show. Defaults to None.
218
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad. Defaults to None.
219
+ disable_notification (bool, optional): If True, disables notification. Defaults to False.
220
+
221
+ Returns:
222
+ rubigram.types.UMessage: The sent file message.
223
+
224
+ Example:
225
+ >>> await update.reply_file("example.pdf", caption="Here is your file")
226
+ """
227
+ return await self.client.send_file(
228
+ self.chat_id,
229
+ file,
230
+ caption,
231
+ file_name,
232
+ type,
233
+ chat_keypad,
234
+ inline_keypad,
235
+ chat_keypad_type,
236
+ disable_notification,
237
+ self.new_message.message_id if self.new_message else None,
238
+ )
239
+
240
+ async def reply_document(
241
+ self,
242
+ document: Union[str, bytes],
243
+ caption: Optional[str] = None,
244
+ file_name: Optional[str] = None,
245
+ chat_keypad: Optional[Keypad] = None,
246
+ inline_keypad: Optional[Keypad] = None,
247
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
248
+ disable_notification: bool = False,
249
+ ) -> "rubigram.types.UMessage":
250
+ """Reply to the current message with a document file.
251
+
252
+ This method sends a document as a reply to the current message, optionally with a caption,
253
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
254
+
255
+ Args:
256
+ document (Union[str, bytes]): The path or bytes of the document to send.
257
+ caption (Optional[str], optional): Text caption for the document. Defaults to None.
258
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
259
+ type (Optional[Union[str, enums.FileType]], optional): The type of the file. Defaults to enums.FileType.Document.
260
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
261
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
262
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
263
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
264
+
265
+ Returns:
266
+ rubigram.types.UMessage: The sent reply message object.
267
+
268
+ Example:
269
+ >>> await update.reply_document(
270
+ >>> document="example.pdf",
271
+ >>> caption="Here is the file",
272
+ >>> chat_keypad=keypad
273
+ >>> )
274
+ """
275
+ return await self.reply_file(
276
+ document,
277
+ caption,
278
+ file_name,
279
+ "File",
280
+ chat_keypad,
281
+ inline_keypad,
282
+ chat_keypad_type,
283
+ disable_notification
284
+ )
285
+
286
+ async def reply_photo(
287
+ self,
288
+ photo: Union[str, bytes],
289
+ caption: Optional[str] = None,
290
+ file_name: Optional[str] = None,
291
+ chat_keypad: Optional[Keypad] = None,
292
+ inline_keypad: Optional[Keypad] = None,
293
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
294
+ disable_notification: bool = False,
295
+ ) -> "rubigram.types.UMessage":
296
+ """Reply to the current message with a photo.
297
+
298
+ This method sends a photo as a reply to the current message, optionally with a caption,
299
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
300
+
301
+ Args:
302
+ photo (Union[str, bytes]): The path or bytes of the photo to send.
303
+ caption (Optional[str], optional): Text caption for the photo. Defaults to None.
304
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
305
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
306
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
307
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
308
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
309
+
310
+ Returns:
311
+ rubigram.types.UMessage: The sent reply message object.
312
+
313
+ Example:
314
+ >>> await update.reply_photo(
315
+ >>> photo="example.jpg",
316
+ >>> caption="Here is the photo",
317
+ >>> chat_keypad=keypad
318
+ >>> )
319
+ """
320
+ return await self.reply_file(
321
+ photo,
322
+ caption,
323
+ file_name,
324
+ "Image",
325
+ chat_keypad,
326
+ inline_keypad,
327
+ chat_keypad_type,
328
+ disable_notification
329
+ )
330
+
331
+ async def reply_video(
332
+ self,
333
+ video: Union[str, bytes],
334
+ caption: Optional[str] = None,
335
+ file_name: Optional[str] = None,
336
+ chat_keypad: Optional[Keypad] = None,
337
+ inline_keypad: Optional[Keypad] = None,
338
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
339
+ disable_notification: bool = False,
340
+ ) -> "rubigram.types.UMessage":
341
+ """Reply to the current message with a video file.
342
+
343
+ This method sends a video as a reply to the current message, optionally with a caption,
344
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
345
+
346
+ Args:
347
+ video (Union[str, bytes]): The path or bytes of the video to send.
348
+ caption (Optional[str], optional): Text caption for the video. Defaults to None.
349
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
350
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
351
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
352
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
353
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
354
+
355
+ Returns:
356
+ rubigram.types.UMessage: The sent reply message object.
357
+
358
+ Example:
359
+ >>> await update.reply_video(
360
+ >>> video="example.mp4",
361
+ >>> caption="Here is the video",
362
+ >>> chat_keypad=keypad
363
+ >>> )
364
+ """
365
+ return await self.reply_file(
366
+ video,
367
+ caption,
368
+ file_name,
369
+ "Video",
370
+ chat_keypad,
371
+ inline_keypad,
372
+ chat_keypad_type,
373
+ disable_notification
374
+ )
375
+
376
+ async def reply_gif(
377
+ self,
378
+ gif: Union[str, bytes],
379
+ caption: Optional[str] = None,
380
+ file_name: Optional[str] = None,
381
+ chat_keypad: Optional[Keypad] = None,
382
+ inline_keypad: Optional[Keypad] = None,
383
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
384
+ disable_notification: bool = False,
385
+ ) -> "rubigram.types.UMessage":
386
+ """Reply to the current message with a GIF file.
387
+
388
+ This method sends a GIF as a reply to the current message, optionally with a caption,
389
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
390
+
391
+ Args:
392
+ gif (Union[str, bytes]): The path or bytes of the GIF to send.
393
+ caption (Optional[str], optional): Text caption for the GIF. Defaults to None.
394
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
395
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
396
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
397
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
398
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
399
+
400
+ Returns:
401
+ rubigram.types.UMessage: The sent reply message object.
402
+
403
+ Example:
404
+ >>> await update.reply_gif(
405
+ >>> gif="funny.gif",
406
+ >>> caption="Check out this GIF!",
407
+ >>> chat_keypad=keypad
408
+ >>> )
409
+ """
410
+ return await self.reply_file(
411
+ gif,
412
+ caption,
413
+ file_name,
414
+ "Gif",
415
+ chat_keypad,
416
+ inline_keypad,
417
+ chat_keypad_type,
418
+ disable_notification
419
+ )
420
+
421
+ async def reply_music(
422
+ self,
423
+ music: Union[str, bytes],
424
+ caption: Optional[str] = None,
425
+ file_name: Optional[str] = None,
426
+ chat_keypad: Optional[Keypad] = None,
427
+ inline_keypad: Optional[Keypad] = None,
428
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
429
+ disable_notification: bool = False,
430
+ ) -> "rubigram.types.UMessage":
431
+ """Reply to the current message with a music/audio file.
432
+
433
+ This method sends a music/audio file as a reply to the current message, optionally with a caption,
434
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
435
+
436
+ Args:
437
+ music (Union[str, bytes]): The path or bytes of the music file to send.
438
+ caption (Optional[str], optional): Text caption for the music. Defaults to None.
439
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
440
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
441
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
442
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
443
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
444
+
445
+ Returns:
446
+ rubigram.types.UMessage: The sent reply message object.
447
+
448
+ Example:
449
+ >>> await update.reply_music(
450
+ >>> music="song.mp3",
451
+ >>> caption="Listen to this!",
452
+ >>> chat_keypad=keypad
453
+ >>> )
454
+ """
455
+ return await self.reply_file(
456
+ music,
457
+ caption,
458
+ file_name,
459
+ "Music",
460
+ chat_keypad,
461
+ inline_keypad,
462
+ chat_keypad_type,
463
+ disable_notification
464
+ )
465
+
466
+ async def reply_voice(
467
+ self,
468
+ voice: Union[str, bytes],
469
+ caption: Optional[str] = None,
470
+ file_name: Optional[str] = None,
471
+ chat_keypad: Optional[Keypad] = None,
472
+ inline_keypad: Optional[Keypad] = None,
473
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
474
+ disable_notification: bool = False,
475
+ ) -> "rubigram.types.UMessage":
476
+ """Reply to the current message with a voice note.
477
+
478
+ This method sends a voice message as a reply to the current message, optionally with a caption,
479
+ custom file name, chat or inline keypads, chat keypad type, and notification control.
480
+
481
+ Args:
482
+ voice (Union[str, bytes]): The path or bytes of the voice file to send.
483
+ caption (Optional[str], optional): Text caption for the voice message. Defaults to None.
484
+ file_name (Optional[str], optional): Custom name for the file. Defaults to None.
485
+ chat_keypad (Optional[Keypad], optional): Keypad to attach to the chat. Defaults to None.
486
+ inline_keypad (Optional[Keypad], optional): Keypad to attach inline. Defaults to None.
487
+ chat_keypad_type (Optional[enums.ChatKeypadType], optional): Type of chat keypad if applicable. Defaults to None.
488
+ disable_notification (bool, optional): If True, disables notification for this message. Defaults to False.
489
+
490
+ Returns:
491
+ rubigram.types.UMessage: The sent reply message object.
492
+
493
+ Example:
494
+ >>> await update.reply_voice(
495
+ >>> voice="voice.ogg",
496
+ >>> caption="Listen to this voice note!",
497
+ >>> chat_keypad=keypad
498
+ >>> )
499
+ """
500
+ return await self.reply_file(
501
+ voice,
502
+ caption,
503
+ file_name,
504
+ "Voice",
505
+ chat_keypad,
506
+ inline_keypad,
507
+ chat_keypad_type,
508
+ disable_notification
509
+ )
510
+
511
+ async def download(
512
+ self,
513
+ save_as: str
514
+ ) -> str:
515
+ """Download the file attached to the current message.
516
+
517
+ This method downloads the file associated with the message (if any)
518
+ and saves it locally with the specified file name.
519
+
520
+ Args:
521
+ file_name (str): The name (including path if needed) to save the downloaded file as.
522
+
523
+ Returns:
524
+ str: The path to the downloaded file.
525
+
526
+ Example:
527
+ >>> await update.download("my_file.pdf")
528
+ """
529
+ return await self.client.download_file(
530
+ self.new_message.file.file_id,
531
+ save_as
532
+ )
533
+
534
+ async def forward(
535
+ self,
536
+ chat_id: str
537
+ ) -> "rubigram.types.UMessage":
538
+ """Forward the current message to another chat.
539
+
540
+ This method forwards the message represented by this update to the specified chat ID.
541
+
542
+ Args:
543
+ chat_id (str): The target chat ID to forward the message to.
544
+
545
+ Returns:
546
+ rubigram.types.UMessage: The forwarded message object in the target chat.
547
+
548
+ Example:
549
+ >>> await update.forward("g0123456789")
550
+ """
551
+ return await self.client.forward_message(
552
+ self.chat_id,
553
+ self.new_message.message_id,
554
+ chat_id
555
+ )
556
+
557
+
558
+ @dataclass
559
+ class Updates(Object):
560
+ updates: Optional[list["rubigram.types.Update"]] = None
561
+ next_offset_id: Optional[str] = None
562
+
563
+ @classmethod
564
+ def parse(cls, data: dict):
565
+ data = data or {}
566
+ updates = [
567
+ rubigram.types.Update.parse(update) if isinstance(update, dict) else update for update in data.get("updates", []) or []
568
+ ]
569
+ return cls(
570
+ updates=updates,
571
+ next_offset_id=data.get("next_offset_id")
572
+ )
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RubigramClient
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
5
- Author-email: Javad RZ <MrJavad.Email@gmail.com>
5
+ Author-email: Javad <MrJavad.Email@gmail.com>
6
6
  License: MIT License
7
7
 
8
8
  Copyright (c) 2025 Javad
@@ -24,6 +24,7 @@ License: MIT License
24
24
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/Javad-RZ/rubigram
27
28
  Classifier: Programming Language :: Python :: 3
28
29
  Classifier: License :: OSI Approved :: MIT License
29
30
  Classifier: Operating System :: OS Independent
@@ -34,12 +35,15 @@ Requires-Dist: aiohttp
34
35
  Requires-Dist: aiofiles
35
36
  Dynamic: license-file
36
37
 
37
- <img src="http://rubigram.ir/Rubigram.jpg" alt="Rubigram Logo" width="200"/>
38
-
39
-
40
38
  # Rubigram
41
39
  A lightweight Python library to build Rubika bots easily.
42
40
 
41
+ <div align="center">
42
+ <img src="http://rubigram.ir/rubigram.jpg" alt="Rubigram Logo" width="200"/>
43
+ </div>
44
+
45
+
46
+
43
47
  ## Installation
44
48
  ```bash
45
49
  pip install RubigramClient
@@ -52,7 +56,7 @@ from rubigram import Client
52
56
  bot = Client(token="YOUR_TOKEN")
53
57
 
54
58
  @bot.on_message()
55
- async def echo(client, message):
59
+ async def handler(client, message):
56
60
  await message.reply("Hello Rubigram!")
57
61
 
58
62
  bot.run()
@@ -66,8 +70,8 @@ from rubigram.types import Update
66
70
  bot = Client(token="YOUR_TOKEN_BOT")
67
71
 
68
72
  @bot.on_message(filters.private)
69
- async def welcome_message(client, message: Update):
70
- send = await message.reply("Hi, WELCOME TO RUBIGRAM")
73
+ async def echo(client, message: Update):
74
+ send = await message.reply(f"Hi, {message.new_message.text}")
71
75
  await send.edit_text("message was edited")
72
76
 
73
77
  bot.run()