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

rubigram/types.py ADDED
@@ -0,0 +1,420 @@
1
+ from typing import Optional, Any
2
+ from pydantic import BaseModel
3
+ from rubigram import enums
4
+
5
+
6
+ class DataManager(BaseModel):
7
+ class Config:
8
+ use_enum_values = True
9
+ arbitrary_types_allowed = True
10
+
11
+ @classmethod
12
+ def from_dict(cls, data: dict):
13
+ return cls.model_validate(data or {})
14
+
15
+ def asdict(self, exclude_none: bool = True) -> dict:
16
+ return self.model_dump(exclude_none=exclude_none, exclude={"client"})
17
+
18
+ def asjson(self, exclude_none: bool = True) -> str:
19
+ return self.model_dump_json(indent=4, exclude_none=exclude_none, exclude={"client"})
20
+
21
+
22
+ class Chat(DataManager):
23
+ chat_id: Optional[str] = None
24
+ chat_type: Optional[enums.ChatType] = None
25
+ user_id: Optional[str] = None
26
+ first_name: Optional[str] = None
27
+ last_name: Optional[str] = None
28
+ title: Optional[str] = None
29
+ username: Optional[str] = None
30
+
31
+
32
+ class File(DataManager):
33
+ file_id: Optional[str] = None
34
+ file_name: Optional[str] = None
35
+ size: Optional[str] = None
36
+
37
+
38
+ class ForwardedFrom(DataManager):
39
+ type_from: Optional[enums.ForwardedFrom] = None
40
+ message_id: Optional[str] = None
41
+ from_chat_id: Optional[str] = None
42
+ from_sender_id: Optional[str] = None
43
+
44
+
45
+ class PaymentStatus(DataManager):
46
+ payment_id: Optional[str] = None
47
+ status: Optional[enums.PaymentStatus] = None
48
+
49
+
50
+ class MessageTextUpdate(DataManager):
51
+ message_id: Optional[str] = None
52
+ text: Optional[str] = None
53
+
54
+
55
+ class Bot(DataManager):
56
+ bot_id: Optional[str] = None
57
+ bot_title: Optional[str] = None
58
+ avatar: Optional[File] = None
59
+ description: Optional[str] = None
60
+ username: Optional[str] = None
61
+ start_message: Optional[str] = None
62
+ share_url: Optional[str] = None
63
+
64
+
65
+ class BotCommand(DataManager):
66
+ command: Optional[str] = None
67
+ description: Optional[str] = None
68
+
69
+
70
+ class Sticker(DataManager):
71
+ sticker_id: Optional[str] = None
72
+ file: Optional[File] = None
73
+ emoji_character: Optional[str] = None
74
+
75
+
76
+ class ContactMessage(DataManager):
77
+ phone_number: Optional[str] = None
78
+ first_name: Optional[str] = None
79
+ last_name: Optional[str] = None
80
+
81
+
82
+ class PollStatus(DataManager):
83
+ state: Optional[enums.PollStatus] = None
84
+ selection_index: Optional[int] = None
85
+ percent_vote_options: Optional[list[int]] = None
86
+ total_vote: Optional[int] = None
87
+ show_total_votes: Optional[bool] = None
88
+
89
+
90
+ class Poll(DataManager):
91
+ question: Optional[str] = None
92
+ options: Optional[list[str]] = None
93
+ poll_status: Optional[PollStatus] = None
94
+
95
+
96
+ class Location(DataManager):
97
+ longitude: Optional[str] = None
98
+ latitude: Optional[str] = None
99
+
100
+
101
+ class LiveLocation(DataManager):
102
+ start_time: Optional[str] = None
103
+ live_period: Optional[int] = None
104
+ current_location: Optional[Location] = None
105
+ user_id: Optional[str] = None
106
+ status: Optional[enums.LiveLocationStatus] = None
107
+ last_update_time: Optional[str] = None
108
+
109
+
110
+ class ButtonSelectionItem(DataManager):
111
+ text: Optional[str] = None
112
+ image_url: Optional[str] = None
113
+ type: Optional[enums.ButtonSelectionType] = None
114
+
115
+
116
+ class ButtonSelection(DataManager):
117
+ selection_id: Optional[str] = None
118
+ search_type: Optional[str] = None
119
+ get_type: Optional[str] = None
120
+ items: Optional[list[ButtonSelectionItem]] = None
121
+ is_multi_selection: Optional[bool] = None
122
+ columns_count: Optional[str] = None
123
+ title: Optional[str] = None
124
+
125
+
126
+ class ButtonCalendar(DataManager):
127
+ default_value: Optional[str] = None
128
+ type: Optional[enums.ButtonCalendarType] = None
129
+ min_year: Optional[str] = None
130
+ max_year: Optional[str] = None
131
+ title: Optional[str] = None
132
+
133
+
134
+ class ButtonNumberPicker(DataManager):
135
+ min_value: Optional[str] = None
136
+ max_value: Optional[str] = None
137
+ default_value: Optional[str] = None
138
+ title: Optional[str] = None
139
+
140
+
141
+ class ButtonStringPicker(DataManager):
142
+ items: Optional[list[str]] = None
143
+ default_value: Optional[str] = None
144
+ title: Optional[str] = None
145
+
146
+
147
+ class ButtonTextbox(DataManager):
148
+ type_line: Optional[enums.ButtonTextboxTypeLine] = None
149
+ type_keypad: Optional[enums.ButtonTextboxTypeKeypad] = None
150
+ place_holder: Optional[str] = None
151
+ title: Optional[str] = None
152
+ default_value: Optional[str] = None
153
+
154
+
155
+ class ButtonLocation(DataManager):
156
+ default_pointer_location: Optional[Location] = None
157
+ default_map_location: Optional[Location] = None
158
+ type: Optional[enums.ButtonLocationType] = None
159
+ title: Optional[str] = None
160
+ location_image_url: Optional[str] = None
161
+
162
+
163
+ class OpenChatData(DataManager):
164
+ object_guid: Optional[str] = None
165
+ object_type: Optional[enums.ChatType] = None
166
+
167
+
168
+ class JoinChannelData(DataManager):
169
+ username: Optional[str] = None
170
+ ask_join: bool = False
171
+
172
+
173
+ class ButtonLink(DataManager):
174
+ type: Optional[enums.ButtonLinkType] = None
175
+ link_url: Optional[str] = None
176
+ joinchannel_data: Optional[JoinChannelData] = None
177
+ open_chat_data: Optional[OpenChatData] = None
178
+
179
+
180
+ class AuxData(DataManager):
181
+ start_id: Optional[str] = None
182
+ button_id: Optional[str] = None
183
+
184
+
185
+ class Button(DataManager):
186
+ id: Optional[str] = None
187
+ button_text: Optional[str] = None
188
+ type: enums.ButtonType = enums.ButtonType.Simple
189
+ button_selection: Optional[ButtonSelection] = None
190
+ button_calendar: Optional[ButtonCalendar] = None
191
+ button_number_picker: Optional[ButtonNumberPicker] = None
192
+ button_string_picker: Optional[ButtonStringPicker] = None
193
+ button_location: Optional[ButtonLocation] = None
194
+ button_textbox: Optional[ButtonTextbox] = None
195
+ button_link: Optional[ButtonLink] = None
196
+
197
+
198
+ class KeypadRow(DataManager):
199
+ buttons: list[Button]
200
+
201
+
202
+ class Keypad(DataManager):
203
+ rows: list[KeypadRow]
204
+ resize_keyboard: bool = True
205
+ on_time_keyboard: bool = False
206
+
207
+
208
+ class MessageKeypadUpdate(DataManager):
209
+ message_id: Optional[str] = None
210
+ inline_keypad: Optional[Keypad] = None
211
+
212
+
213
+ class Message(DataManager):
214
+ message_id: Optional[str] = None
215
+ text: Optional[str] = None
216
+ time: Optional[str] = None
217
+ is_edited: Optional[bool] = None
218
+ sender_type: Optional[enums.MessageSender] = None
219
+ sender_id: Optional[str] = None
220
+ aux_data: Optional[AuxData] = None
221
+ file: Optional[File] = None
222
+ reply_to_message_id: Optional[str] = None
223
+ forwarded_from: Optional[ForwardedFrom] = None
224
+ forwarded_no_link: Optional[str] = None
225
+ location: Optional[Location] = None
226
+ sticker: Optional[Sticker] = None
227
+ contact_message: Optional[ContactMessage] = None
228
+ poll: Optional[Poll] = None
229
+ live_location: Optional[LiveLocation] = None
230
+
231
+
232
+ class MessageId(DataManager):
233
+ message_id: Optional[str] = None
234
+ file_id: Optional[str] = None
235
+ chat_id: Optional[str] = None
236
+ client: Optional[Any] = None
237
+
238
+ async def delete(self):
239
+ return await self.client.delete_message(self.chat_id, self.message_id)
240
+
241
+ async def edit_text(self, text: str):
242
+ return await self.client.edit_message_text(self.chat_id, self.message_id, text)
243
+
244
+ async def edit_message_keypad(self, keypad: Keypad):
245
+ return await self.client.edit_message_keypad(self.chat_id, self.message_id, keypad)
246
+
247
+ async def forward(self, chat_id: str):
248
+ return await self.client.forward_message(self.chat_id, self.message_id, chat_id)
249
+
250
+
251
+ class Update(DataManager):
252
+ client: Optional[Any] = None
253
+ type: Optional[enums.UpdateType] = None
254
+ chat_id: Optional[str] = None
255
+ removed_message_id: Optional[str] = None
256
+ new_message: Optional[Message] = None
257
+ updated_message: Optional[Message] = None
258
+ updated_payment: Optional[PaymentStatus] = None
259
+
260
+ async def download(self, file_name: str):
261
+ return await self.client.download_file(self.new_message.file.file_id, file_name)
262
+
263
+ async def forward(self, chat_id: str):
264
+ return await self.client.forward_message(self.chat_id, self.new_message.message_id, chat_id)
265
+
266
+ async def reply(
267
+ self,
268
+ text: str,
269
+ chat_keypad: Keypad = None,
270
+ inline_keypad: Keypad = None,
271
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
272
+ disable_notification: bool = None,
273
+ ) -> "MessageId":
274
+ return await self.client.send_message(
275
+ self.chat_id,
276
+ text,
277
+ chat_keypad,
278
+ inline_keypad,
279
+ chat_keypad_type,
280
+ disable_notification,
281
+ self.new_message.message_id,
282
+ )
283
+
284
+ async def reply_poll(
285
+ self,
286
+ question: str,
287
+ options: list[str],
288
+ chat_keypad: Keypad = None,
289
+ inline_keypad: Keypad = None,
290
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
291
+ disable_notification: bool = False,
292
+ ) -> "MessageId":
293
+ return await self.client.send_poll(
294
+ self.chat_id,
295
+ question,
296
+ options,
297
+ chat_keypad,
298
+ inline_keypad,
299
+ chat_keypad_type,
300
+ disable_notification,
301
+ self.new_message.message_id,
302
+ )
303
+
304
+ async def reply_location(
305
+ self,
306
+ latitude: str,
307
+ longitude: str,
308
+ chat_keypad: Keypad = None,
309
+ inline_keypad: Keypad = None,
310
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
311
+ disable_notification: bool = False,
312
+ ) -> "MessageId":
313
+ return await self.client.send_location(
314
+ self.chat_id,
315
+ latitude,
316
+ longitude,
317
+ chat_keypad,
318
+ inline_keypad,
319
+ chat_keypad_type,
320
+ disable_notification,
321
+ self.new_message.message_id,
322
+ )
323
+
324
+ async def reply_contact(
325
+ self,
326
+ first_name: str,
327
+ last_name: str,
328
+ phone_number: str,
329
+ chat_keypad: Keypad = None,
330
+ inline_keypad: Keypad = None,
331
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
332
+ disable_notification: bool = False,
333
+ ) -> "MessageId":
334
+ return await self.client.send_location(
335
+ self.chat_id,
336
+ first_name,
337
+ last_name,
338
+ phone_number,
339
+ chat_keypad,
340
+ inline_keypad,
341
+ chat_keypad_type,
342
+ disable_notification,
343
+ self.new_message.message_id,
344
+ )
345
+
346
+ async def reply_sticker(
347
+ self,
348
+ sticker_id: str,
349
+ chat_keypad: Keypad = None,
350
+ inline_keypad: Keypad = None,
351
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
352
+ disable_notification: bool = False,
353
+ ) -> "MessageId":
354
+ return await self.client.send_message(
355
+ self.chat_id,
356
+ sticker_id,
357
+ chat_keypad,
358
+ inline_keypad,
359
+ chat_keypad_type,
360
+ disable_notification,
361
+ self.new_message.message_id,
362
+ )
363
+
364
+ async def reply_file(
365
+ self,
366
+ file: str,
367
+ file_name: str,
368
+ caption: str = None,
369
+ type: enums.FileType = enums.FileType.File,
370
+ chat_keypad: Keypad = None,
371
+ inline_keypad: Keypad = None,
372
+ chat_keypad_type: Optional[enums.ChatKeypadType] = None,
373
+ disable_notification: bool = False,
374
+ ) -> "MessageId":
375
+ return await self.client.send_file(
376
+ self.chat_id,
377
+ file,
378
+ file_name,
379
+ caption,
380
+ type,
381
+ chat_keypad,
382
+ inline_keypad,
383
+ chat_keypad_type,
384
+ disable_notification,
385
+ self.new_message.message_id,
386
+ )
387
+
388
+ async def reply_document(self, document: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
389
+ return await self.reply_file(document, name, caption, "File", **kwargs)
390
+
391
+ async def reply_photo(self, photo: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
392
+ return await self.reply_file(photo, name, caption, "Image", **kwargs)
393
+
394
+ async def reply_video(self, video: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
395
+ return await self.reply_file(video, name, caption, "Video", **kwargs)
396
+
397
+ async def reply_gif(self, gif: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
398
+ return await self.reply_file(gif, name, caption, "Gif", **kwargs)
399
+
400
+ async def reply_music(self, music: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
401
+ return await self.reply_file(music, name, caption, "Music", **kwargs)
402
+
403
+ async def reply_voice(self, voice: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
404
+ return await self.reply_file(voice, name, caption, "Voice", **kwargs)
405
+
406
+
407
+ class Updates(DataManager):
408
+ updates: Optional[list[Update]] = None
409
+ next_offset_id: Optional[str] = None
410
+
411
+
412
+ class InlineMessage(DataManager):
413
+ client: Optional[Any] = None
414
+ sender_id: Optional[str] = None
415
+ text: Optional[str] = None
416
+ message_id: Optional[str] = None
417
+ chat_id: Optional[str] = None
418
+ file: Optional[File] = None
419
+ location: Optional[Location] = None
420
+ aux_data: Optional[AuxData] = None
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RubigramClient
3
- Version: 1.6.4
3
+ Version: 1.6.6
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 <Javad.Py1385@gmail.com>
5
+ Author-email: Javad RZ <MrJavad.Email@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
7
7
  Classifier: License :: OSI Approved :: MIT License
8
8
  Classifier: Operating System :: OS Independent
@@ -11,7 +11,7 @@ Description-Content-Type: text/markdown
11
11
  License-File: LICENSE
12
12
  Requires-Dist: aiohttp
13
13
  Requires-Dist: aiofiles
14
- Requires-Dist: aiosqlite
14
+ Requires-Dist: pydantic
15
15
  Dynamic: license-file
16
16
 
17
17
  # Rubigram
@@ -25,12 +25,12 @@ pip install RubigramClient
25
25
  ## Send Message
26
26
  ```python
27
27
  from rubigram import Client, filters
28
- from rubigram.models import Update
28
+ from rubigram.types import Update
29
29
 
30
- bot = Client("your_bot_token")
30
+ bot = Client(token="YOUR_TOKEN_BOT")
31
31
 
32
- @bot.on_message(filters.command("start") & filters.private)
33
- async def start_handler(client, message: Update):
32
+ @bot.on_message(filters.private)
33
+ async def welcome_message(client, message: Update):
34
34
  await message.reply("Hi, WELCOME TO RUBIGRAM")
35
35
 
36
36
  bot.run()
@@ -39,10 +39,10 @@ bot.run()
39
39
  ## Send Message & Get receiveInlineMessage
40
40
  ```python
41
41
  from rubigram import Client, filters
42
- from rubigram.models import Update, Button, Keypad, KeypadRow, InlineMessage
42
+ from rubigram.types import Update, Button, Keypad, KeypadRow, InlineMessage
43
43
 
44
44
 
45
- bot = Client(token="bot_token", endpoint="endpoint_url")
45
+ bot = Client(token="BOT_TOKEN", endpoint="ENDPOINT_URL")
46
46
 
47
47
 
48
48
  @bot.on_message(filters.command("start"))
@@ -75,7 +75,7 @@ bot.run()
75
75
  from rubigram import Client
76
76
  import asyncio
77
77
 
78
- bot = Client("bot_token")
78
+ bot = Client("YOUR_BOT_TOKEN")
79
79
 
80
80
  async def main():
81
81
  async with bot:
@@ -0,0 +1,13 @@
1
+ rubigram/__init__.py,sha256=h2O7aVl3woDBTHX0MdZLbhgvVRTyXA0NTzOz7F8Y7Xg,124
2
+ rubigram/client.py,sha256=CeSrSsPTg7cF0JSUXgzUVLU4ULD4dhvTZ28zY8zgDDE,5011
3
+ rubigram/enums.py,sha256=UZKH1wROBVMuHVEjrnQSwpi-y2MxMI7zl2uThdPTWoc,2722
4
+ rubigram/filters.py,sha256=40znxAC7xAFYCeERlPYLSVtr0lxUcnQY2HRwt1zSfdk,6838
5
+ rubigram/method.py,sha256=Ltlfh1Jy26CKfCz5fez2jifWWCfB8mAWBQKmAu20I0E,11076
6
+ rubigram/network.py,sha256=84-2Grde0GUDOpia6O-7oJNlupBw30ga5VE4sve31dY,2361
7
+ rubigram/state.py,sha256=_g13o87MHfuudbgvbfu9vAOrSzw4GhdEYkD6dSn7t2s,997
8
+ rubigram/types.py,sha256=9eA-mbhW8ILK0MJ4oJMhK00XRHvUe4EumgECgHNPvVM,13395
9
+ rubigramclient-1.6.6.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
+ rubigramclient-1.6.6.dist-info/METADATA,sha256=gJan_rPbbbecSrLfkpibqZzyIUfOxcmnqLEH_1Qdk5M,2260
11
+ rubigramclient-1.6.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
12
+ rubigramclient-1.6.6.dist-info/top_level.txt,sha256=Mhg5HfkL6rLec5sI4ClGmwoqYUANAZUz8sVa1sT_cas,9
13
+ rubigramclient-1.6.6.dist-info/RECORD,,