RubigramClient 1.4.2__py3-none-any.whl → 1.4.4__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/filters.py CHANGED
@@ -38,11 +38,11 @@ class command(Filter):
38
38
  text = update.new_message.text
39
39
  elif update.type == "UpdatedMessage":
40
40
  text = update.updated_message.text
41
-
42
- for cmd in commands:
43
- if text.lower().startswith(self.prefix + cmd.lower()):
44
- return True
45
- return False
41
+ if text:
42
+ for cmd in commands:
43
+ if text.lower().startswith(self.prefix + cmd.lower()):
44
+ return True
45
+ return False
46
46
 
47
47
 
48
48
  class regex(Filter):
rubigram/types.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from dataclasses import dataclass, fields, is_dataclass
2
2
  from typing import Any, Type, Union, TypeVar, Literal, Optional, get_origin, get_args
3
3
  import rubigram
4
+ import json
4
5
 
5
6
 
6
7
  T = TypeVar("T", bound="Dict")
@@ -51,24 +52,36 @@ class Dict:
51
52
  init_data[field.name] = value
52
53
  return cls(**init_data)
53
54
 
55
+ def to_json(self):
56
+ return json.dumps(self.to_dict(), ensure_ascii=False, indent=4)
57
+
54
58
 
55
59
  @dataclass
56
60
  class Location(Dict):
57
61
  longitude: Optional[str] = None
58
62
  latitude: Optional[str] = None
59
63
 
64
+ def __repr__(self):
65
+ return self.to_json()
66
+
60
67
 
61
68
  @dataclass
62
69
  class OpenChatData(Dict):
63
70
  object_guid: Optional[str] = None
64
71
  object_type: Optional[Literal["User", "Bot", "Group", "Channel"]] = None
65
72
 
73
+ def __repr__(self):
74
+ return self.to_json()
75
+
66
76
 
67
77
  @dataclass
68
78
  class JoinChannelData(Dict):
69
79
  username: Optional[str] = None
70
80
  ask_join: Optional[bool] = False
71
81
 
82
+ def __repr__(self):
83
+ return self.to_json()
84
+
72
85
 
73
86
  @dataclass
74
87
  class ButtonLink(Dict):
@@ -77,6 +90,9 @@ class ButtonLink(Dict):
77
90
  joinchannel_data: Optional[JoinChannelData] = None
78
91
  open_chat_data: Optional[OpenChatData] = None
79
92
 
93
+ def __repr__(self):
94
+ return self.to_json()
95
+
80
96
 
81
97
  @dataclass
82
98
  class ButtonSelectionItem(Dict):
@@ -84,6 +100,9 @@ class ButtonSelectionItem(Dict):
84
100
  image_url: Optional[str] = None
85
101
  type: Optional[Literal["TextOnly", "TextImgThu", "TextImgBig"]] = None
86
102
 
103
+ def __repr__(self):
104
+ return self.to_json()
105
+
87
106
 
88
107
  @dataclass
89
108
  class ButtonTextbox(Dict):
@@ -93,6 +112,9 @@ class ButtonTextbox(Dict):
93
112
  title: Optional[str] = None
94
113
  default_value: Optional[str] = None
95
114
 
115
+ def __repr__(self):
116
+ return self.to_json()
117
+
96
118
 
97
119
  @dataclass
98
120
  class ButtonLocation(Dict):
@@ -102,6 +124,9 @@ class ButtonLocation(Dict):
102
124
  title: Optional[str] = None
103
125
  location_image_url: Optional[str] = None
104
126
 
127
+ def __repr__(self):
128
+ return self.to_json()
129
+
105
130
 
106
131
  @dataclass
107
132
  class ButtonStringPicker(Dict):
@@ -109,6 +134,9 @@ class ButtonStringPicker(Dict):
109
134
  default_value: Optional[str] = None
110
135
  title: Optional[str] = None
111
136
 
137
+ def __repr__(self):
138
+ return self.to_json()
139
+
112
140
 
113
141
  @dataclass
114
142
  class ButtonNumberPicker(Dict):
@@ -117,6 +145,9 @@ class ButtonNumberPicker(Dict):
117
145
  default_value: Optional[str] = None
118
146
  title: Optional[str] = None
119
147
 
148
+ def __repr__(self):
149
+ return self.to_json()
150
+
120
151
 
121
152
  @dataclass
122
153
  class ButtonCalendar(Dict):
@@ -126,6 +157,9 @@ class ButtonCalendar(Dict):
126
157
  max_year: Optional[str] = None
127
158
  title: Optional[str] = None
128
159
 
160
+ def __repr__(self):
161
+ return self.to_json()
162
+
129
163
 
130
164
  @dataclass
131
165
  class ButtonSelection(Dict):
@@ -137,6 +171,9 @@ class ButtonSelection(Dict):
137
171
  columns_count: Optional[str] = None
138
172
  title: Optional[str] = None
139
173
 
174
+ def __repr__(self):
175
+ return self.to_json()
176
+
140
177
 
141
178
  @dataclass
142
179
  class Button(Dict):
@@ -155,11 +192,17 @@ class Button(Dict):
155
192
  button_textbox: Optional[ButtonTextbox] = None
156
193
  button_link: Optional[ButtonLink] = None
157
194
 
195
+ def __repr__(self):
196
+ return self.to_json()
197
+
158
198
 
159
199
  @dataclass
160
200
  class KeypadRow(Dict):
161
201
  buttons: list[Button]
162
202
 
203
+ def __repr__(self):
204
+ return self.to_json()
205
+
163
206
 
164
207
  @dataclass
165
208
  class Keypad(Dict):
@@ -167,6 +210,9 @@ class Keypad(Dict):
167
210
  resize_keyboard: bool = True
168
211
  on_time_keyboard: bool = False
169
212
 
213
+ def __repr__(self):
214
+ return self.to_json()
215
+
170
216
 
171
217
  @dataclass
172
218
  class PollStatus(Dict):
@@ -176,6 +222,9 @@ class PollStatus(Dict):
176
222
  total_vote: Optional[int] = None
177
223
  show_total_votes: Optional[bool] = None
178
224
 
225
+ def __repr__(self):
226
+ return self.to_json()
227
+
179
228
 
180
229
  @dataclass
181
230
  class File(Dict):
@@ -183,6 +232,9 @@ class File(Dict):
183
232
  file_name: Optional[str] = None
184
233
  size: Optional[str] = None
185
234
 
235
+ def __repr__(self):
236
+ return self.to_json()
237
+
186
238
 
187
239
  @dataclass
188
240
  class LiveLocation(Dict):
@@ -193,6 +245,9 @@ class LiveLocation(Dict):
193
245
  status: Optional[Literal["Stopped", "Live"]] = None
194
246
  last_update_time: Optional[str] = None
195
247
 
248
+ def __repr__(self):
249
+ return self.to_json()
250
+
196
251
 
197
252
  @dataclass
198
253
  class Poll(Dict):
@@ -200,6 +255,9 @@ class Poll(Dict):
200
255
  options: Optional[list[str]] = None
201
256
  poll_status: Optional[PollStatus] = None
202
257
 
258
+ def __repr__(self):
259
+ return self.to_json()
260
+
203
261
 
204
262
  @dataclass
205
263
  class ContactMessage(Dict):
@@ -207,6 +265,9 @@ class ContactMessage(Dict):
207
265
  first_name: Optional[str] = None
208
266
  last_name: Optional[str] = None
209
267
 
268
+ def __repr__(self):
269
+ return self.to_json()
270
+
210
271
 
211
272
  @dataclass
212
273
  class Sticker(Dict):
@@ -214,6 +275,9 @@ class Sticker(Dict):
214
275
  file: Optional[File] = None
215
276
  emoji_character: Optional[str] = None
216
277
 
278
+ def __repr__(self):
279
+ return self.to_json()
280
+
217
281
 
218
282
  @dataclass
219
283
  class ForwardedFrom(Dict):
@@ -222,18 +286,27 @@ class ForwardedFrom(Dict):
222
286
  from_chat_id: Optional[str] = None
223
287
  from_sender_id: Optional[str] = None
224
288
 
289
+ def __repr__(self):
290
+ return self.to_json()
291
+
225
292
 
226
293
  @dataclass
227
294
  class AuxData(Dict):
228
295
  start_id: Optional[str] = None
229
296
  button_id: Optional[str] = None
230
297
 
298
+ def __repr__(self):
299
+ return self.to_json()
300
+
231
301
 
232
302
  @dataclass
233
303
  class PaymentStatus(Dict):
234
304
  payment_id: Optional[str] = None
235
305
  status: Optional[Literal["Paid", "NotPaid"]] = None
236
306
 
307
+ def __repr__(self):
308
+ return self.to_json()
309
+
237
310
 
238
311
  @dataclass
239
312
  class Message(Dict):
@@ -254,6 +327,9 @@ class Message(Dict):
254
327
  poll: Optional[Poll] = None
255
328
  live_location: Optional[LiveLocation] = None
256
329
 
330
+ def __repr__(self):
331
+ return self.to_json()
332
+
257
333
 
258
334
  @dataclass
259
335
  class InlineMessage(Dict):
@@ -265,6 +341,9 @@ class InlineMessage(Dict):
265
341
  location: Optional[Location] = None
266
342
  aux_data: Optional[AuxData] = None
267
343
 
344
+ def __repr__(self):
345
+ return self.to_json()
346
+
268
347
 
269
348
  @dataclass
270
349
  class Bot(Dict):
@@ -276,6 +355,9 @@ class Bot(Dict):
276
355
  start_message: Optional[str] = None
277
356
  share_url: Optional[str] = None
278
357
 
358
+ def __repr__(self):
359
+ return self.to_json()
360
+
279
361
 
280
362
  @dataclass
281
363
  class Chat(Dict):
@@ -287,12 +369,18 @@ class Chat(Dict):
287
369
  title: Optional[str] = None
288
370
  username: Optional[str] = None
289
371
 
372
+ def __repr__(self):
373
+ return self.to_json()
374
+
290
375
 
291
376
  @dataclass
292
377
  class MessageId(Dict):
293
378
  message_id: Optional[str] = None
294
379
  file_id: Optional[str] = None
295
380
 
381
+ def __repr__(self):
382
+ return self.to_json()
383
+
296
384
 
297
385
  @dataclass
298
386
  class Update(Dict):
@@ -305,9 +393,12 @@ class Update(Dict):
305
393
  updated_message: Optional[Message] = None
306
394
  updated_payment: Optional[PaymentStatus] = None
307
395
 
396
+ def __repr__(self):
397
+ return self.to_json()
398
+
308
399
  async def send_text(self, text: str,) -> "MessageId":
309
400
  return await self.client.send_message(self.chat_id, text)
310
-
401
+
311
402
  async def download(self, name: str):
312
403
  return await self.client.download_file(self.new_message.file.file_id, name)
313
404
 
@@ -356,4 +447,7 @@ class Update(Dict):
356
447
  @dataclass
357
448
  class Updates(Dict):
358
449
  updates: list[Update] = None
359
- next_offset_id: Optional[str] = None
450
+ next_offset_id: Optional[str] = None
451
+
452
+ def __repr__(self):
453
+ return self.to_json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RubigramClient
3
- Version: 1.4.2
3
+ Version: 1.4.4
4
4
  Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
5
5
  Author-email: Javad RZ <Javad.Py1385@gmail.com>
6
6
  Classifier: Programming Language :: Python :: 3
@@ -0,0 +1,11 @@
1
+ rubigram/__init__.py,sha256=Z0foTm6Hpy4CDEH5am-IFWifi0bo4jLvpkfj3JQQHPc,107
2
+ rubigram/client.py,sha256=GqTECi0_rVHV5ZPF-GSL577bT5EEG6RWJqYg8BC1chY,6083
3
+ rubigram/filters.py,sha256=KTuhAtcfKVgRfXGUy5vlUOFDbFwnW70B0WpnAyfJ4pg,5422
4
+ rubigram/method.py,sha256=OnV4O3jLvA453qFxv8dLjX7Vd-XL5goZFnuM-BrjWZM,9920
5
+ rubigram/network.py,sha256=B5y_n7CC7wdMkzNqKpUG9cC7Cq86R0QJCwcScExluvM,2299
6
+ rubigram/types.py,sha256=cQGbLlbVXIQfa8J8EcP2laRtZN6NX6rb3tlX4lsGIZc,13567
7
+ rubigramclient-1.4.4.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
+ rubigramclient-1.4.4.dist-info/METADATA,sha256=kjJRn7E5MkoHCuQbhAraadUZRmevESMK0cDyB1qnob8,2035
9
+ rubigramclient-1.4.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ rubigramclient-1.4.4.dist-info/top_level.txt,sha256=Mhg5HfkL6rLec5sI4ClGmwoqYUANAZUz8sVa1sT_cas,9
11
+ rubigramclient-1.4.4.dist-info/RECORD,,
@@ -1,11 +0,0 @@
1
- rubigram/__init__.py,sha256=Z0foTm6Hpy4CDEH5am-IFWifi0bo4jLvpkfj3JQQHPc,107
2
- rubigram/client.py,sha256=GqTECi0_rVHV5ZPF-GSL577bT5EEG6RWJqYg8BC1chY,6083
3
- rubigram/filters.py,sha256=Zp9V81cHp41Qg4NcupZeZCaGfg3e8UUlHx2B8Xbdv7s,5386
4
- rubigram/method.py,sha256=OnV4O3jLvA453qFxv8dLjX7Vd-XL5goZFnuM-BrjWZM,9920
5
- rubigram/network.py,sha256=B5y_n7CC7wdMkzNqKpUG9cC7Cq86R0QJCwcScExluvM,2299
6
- rubigram/types.py,sha256=_D1raWerXaMhHo0M7i6oFoZOc_RsnlQUXLWlfhnoSDY,11719
7
- rubigramclient-1.4.2.dist-info/licenses/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- rubigramclient-1.4.2.dist-info/METADATA,sha256=lFRnrGhVnO43XBnHi4Za7AQWzipj71yQVR43U_4JzCg,2035
9
- rubigramclient-1.4.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
- rubigramclient-1.4.2.dist-info/top_level.txt,sha256=Mhg5HfkL6rLec5sI4ClGmwoqYUANAZUz8sVa1sT_cas,9
11
- rubigramclient-1.4.2.dist-info/RECORD,,