telegrinder 0.1.dev11__py3-none-any.whl → 0.1.dev14__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 telegrinder might be problematic. Click here for more details.

@@ -13,14 +13,6 @@ class APIMethods:
13
13
  def __init__(self, api: "ABCAPI"):
14
14
  self.api = api
15
15
 
16
- @staticmethod
17
- def get_params(loc: dict) -> dict:
18
- n = {
19
- k: v for k, v in loc.items() if k not in ("self", "other") and v is not None
20
- }
21
- n.update(loc["other"])
22
- return n
23
-
24
16
  async def get_updates(
25
17
  self,
26
18
  offset: typing.Optional[int] = None,
@@ -29,7 +21,7 @@ class APIMethods:
29
21
  allowed_updates: typing.Optional[typing.List[str]] = None,
30
22
  **other
31
23
  ) -> Result[typing.List[Update], APIError]:
32
- result = await self.api.request_raw("getUpdates", self.get_params(locals()))
24
+ result = await self.api.request_raw("getUpdates", get_params(locals()))
33
25
  return full_result(result, typing.List[Update])
34
26
 
35
27
  async def set_webhook(
@@ -43,34 +35,35 @@ class APIMethods:
43
35
  secret_token: typing.Optional[str] = None,
44
36
  **other
45
37
  ) -> Result[bool, APIError]:
46
- result = await self.api.request_raw("setWebhook", self.get_params(locals()))
38
+ result = await self.api.request_raw("setWebhook", get_params(locals()))
47
39
  return full_result(result, bool)
48
40
 
49
41
  async def delete_webhook(
50
42
  self, drop_pending_updates: typing.Optional[bool] = None, **other
51
43
  ) -> Result[bool, APIError]:
52
- result = await self.api.request_raw("deleteWebhook", self.get_params(locals()))
44
+ result = await self.api.request_raw("deleteWebhook", get_params(locals()))
53
45
  return full_result(result, bool)
54
46
 
55
47
  async def get_webhook_info(self, **other) -> Result[WebhookInfo, APIError]:
56
- result = await self.api.request_raw("getWebhookInfo", self.get_params(locals()))
48
+ result = await self.api.request_raw("getWebhookInfo", get_params(locals()))
57
49
  return full_result(result, WebhookInfo)
58
50
 
59
51
  async def get_me(self, **other) -> Result[User, APIError]:
60
- result = await self.api.request_raw("getMe", self.get_params(locals()))
52
+ result = await self.api.request_raw("getMe", get_params(locals()))
61
53
  return full_result(result, User)
62
54
 
63
55
  async def log_out(self, **other) -> Result[bool, APIError]:
64
- result = await self.api.request_raw("logOut", self.get_params(locals()))
56
+ result = await self.api.request_raw("logOut", get_params(locals()))
65
57
  return full_result(result, bool)
66
58
 
67
59
  async def close(self, **other) -> Result[bool, APIError]:
68
- result = await self.api.request_raw("close", self.get_params(locals()))
60
+ result = await self.api.request_raw("close", get_params(locals()))
69
61
  return full_result(result, bool)
70
62
 
71
63
  async def send_message(
72
64
  self,
73
65
  chat_id: typing.Optional[typing.Union[int, str]] = None,
66
+ message_thread_id: typing.Optional[int] = None,
74
67
  text: typing.Optional[str] = None,
75
68
  parse_mode: typing.Optional[str] = None,
76
69
  entities: typing.Optional[typing.List[MessageEntity]] = None,
@@ -89,24 +82,26 @@ class APIMethods:
89
82
  ] = None,
90
83
  **other
91
84
  ) -> Result[Message, APIError]:
92
- result = await self.api.request_raw("sendMessage", self.get_params(locals()))
85
+ result = await self.api.request_raw("sendMessage", get_params(locals()))
93
86
  return full_result(result, Message)
94
87
 
95
88
  async def forward_message(
96
89
  self,
97
90
  chat_id: typing.Optional[typing.Union[int, str]] = None,
91
+ message_thread_id: typing.Optional[int] = None,
98
92
  from_chat_id: typing.Optional[typing.Union[int, str]] = None,
99
93
  disable_notification: typing.Optional[bool] = None,
100
94
  protect_content: typing.Optional[bool] = None,
101
95
  message_id: typing.Optional[int] = None,
102
96
  **other
103
97
  ) -> Result[Message, APIError]:
104
- result = await self.api.request_raw("forwardMessage", self.get_params(locals()))
98
+ result = await self.api.request_raw("forwardMessage", get_params(locals()))
105
99
  return full_result(result, Message)
106
100
 
107
101
  async def copy_message(
108
102
  self,
109
103
  chat_id: typing.Optional[typing.Union[int, str]] = None,
104
+ message_thread_id: typing.Optional[int] = None,
110
105
  from_chat_id: typing.Optional[typing.Union[int, str]] = None,
111
106
  message_id: typing.Optional[int] = None,
112
107
  caption: typing.Optional[str] = None,
@@ -126,12 +121,13 @@ class APIMethods:
126
121
  ] = None,
127
122
  **other
128
123
  ) -> Result[MessageId, APIError]:
129
- result = await self.api.request_raw("copyMessage", self.get_params(locals()))
124
+ result = await self.api.request_raw("copyMessage", get_params(locals()))
130
125
  return full_result(result, MessageId)
131
126
 
132
127
  async def send_photo(
133
128
  self,
134
129
  chat_id: typing.Optional[typing.Union[int, str]] = None,
130
+ message_thread_id: typing.Optional[int] = None,
135
131
  photo: typing.Optional[typing.Union[InputFile, str]] = None,
136
132
  caption: typing.Optional[str] = None,
137
133
  parse_mode: typing.Optional[str] = None,
@@ -150,12 +146,13 @@ class APIMethods:
150
146
  ] = None,
151
147
  **other
152
148
  ) -> Result[Message, APIError]:
153
- result = await self.api.request_raw("sendPhoto", self.get_params(locals()))
149
+ result = await self.api.request_raw("sendPhoto", get_params(locals()))
154
150
  return full_result(result, Message)
155
151
 
156
152
  async def send_audio(
157
153
  self,
158
154
  chat_id: typing.Optional[typing.Union[int, str]] = None,
155
+ message_thread_id: typing.Optional[int] = None,
159
156
  audio: typing.Optional[typing.Union[InputFile, str]] = None,
160
157
  caption: typing.Optional[str] = None,
161
158
  parse_mode: typing.Optional[str] = None,
@@ -178,12 +175,13 @@ class APIMethods:
178
175
  ] = None,
179
176
  **other
180
177
  ) -> Result[Message, APIError]:
181
- result = await self.api.request_raw("sendAudio", self.get_params(locals()))
178
+ result = await self.api.request_raw("sendAudio", get_params(locals()))
182
179
  return full_result(result, Message)
183
180
 
184
181
  async def send_document(
185
182
  self,
186
183
  chat_id: typing.Optional[typing.Union[int, str]] = None,
184
+ message_thread_id: typing.Optional[int] = None,
187
185
  document: typing.Optional[typing.Union[InputFile, str]] = None,
188
186
  thumb: typing.Optional[typing.Union[InputFile, str]] = None,
189
187
  caption: typing.Optional[str] = None,
@@ -204,12 +202,13 @@ class APIMethods:
204
202
  ] = None,
205
203
  **other
206
204
  ) -> Result[Message, APIError]:
207
- result = await self.api.request_raw("sendDocument", self.get_params(locals()))
205
+ result = await self.api.request_raw("sendDocument", get_params(locals()))
208
206
  return full_result(result, Message)
209
207
 
210
208
  async def send_video(
211
209
  self,
212
210
  chat_id: typing.Optional[typing.Union[int, str]] = None,
211
+ message_thread_id: typing.Optional[int] = None,
213
212
  video: typing.Optional[typing.Union[InputFile, str]] = None,
214
213
  duration: typing.Optional[int] = None,
215
214
  width: typing.Optional[int] = None,
@@ -233,12 +232,13 @@ class APIMethods:
233
232
  ] = None,
234
233
  **other
235
234
  ) -> Result[Message, APIError]:
236
- result = await self.api.request_raw("sendVideo", self.get_params(locals()))
235
+ result = await self.api.request_raw("sendVideo", get_params(locals()))
237
236
  return full_result(result, Message)
238
237
 
239
238
  async def send_animation(
240
239
  self,
241
240
  chat_id: typing.Optional[typing.Union[int, str]] = None,
241
+ message_thread_id: typing.Optional[int] = None,
242
242
  animation: typing.Optional[typing.Union[InputFile, str]] = None,
243
243
  duration: typing.Optional[int] = None,
244
244
  width: typing.Optional[int] = None,
@@ -261,12 +261,13 @@ class APIMethods:
261
261
  ] = None,
262
262
  **other
263
263
  ) -> Result[Message, APIError]:
264
- result = await self.api.request_raw("sendAnimation", self.get_params(locals()))
264
+ result = await self.api.request_raw("sendAnimation", get_params(locals()))
265
265
  return full_result(result, Message)
266
266
 
267
267
  async def send_voice(
268
268
  self,
269
269
  chat_id: typing.Optional[typing.Union[int, str]] = None,
270
+ message_thread_id: typing.Optional[int] = None,
270
271
  voice: typing.Optional[typing.Union[InputFile, str]] = None,
271
272
  caption: typing.Optional[str] = None,
272
273
  parse_mode: typing.Optional[str] = None,
@@ -286,12 +287,13 @@ class APIMethods:
286
287
  ] = None,
287
288
  **other
288
289
  ) -> Result[Message, APIError]:
289
- result = await self.api.request_raw("sendVoice", self.get_params(locals()))
290
+ result = await self.api.request_raw("sendVoice", get_params(locals()))
290
291
  return full_result(result, Message)
291
292
 
292
293
  async def send_video_note(
293
294
  self,
294
295
  chat_id: typing.Optional[typing.Union[int, str]] = None,
296
+ message_thread_id: typing.Optional[int] = None,
295
297
  video_note: typing.Optional[typing.Union[InputFile, str]] = None,
296
298
  duration: typing.Optional[int] = None,
297
299
  length: typing.Optional[int] = None,
@@ -310,12 +312,13 @@ class APIMethods:
310
312
  ] = None,
311
313
  **other
312
314
  ) -> Result[Message, APIError]:
313
- result = await self.api.request_raw("sendVideoNote", self.get_params(locals()))
315
+ result = await self.api.request_raw("sendVideoNote", get_params(locals()))
314
316
  return full_result(result, Message)
315
317
 
316
318
  async def send_media_group(
317
319
  self,
318
320
  chat_id: typing.Optional[typing.Union[int, str]] = None,
321
+ message_thread_id: typing.Optional[int] = None,
319
322
  media: typing.Optional[
320
323
  typing.List[
321
324
  typing.Union[
@@ -332,12 +335,13 @@ class APIMethods:
332
335
  allow_sending_without_reply: typing.Optional[bool] = None,
333
336
  **other
334
337
  ) -> Result[typing.List[Message], APIError]:
335
- result = await self.api.request_raw("sendMediaGroup", self.get_params(locals()))
338
+ result = await self.api.request_raw("sendMediaGroup", get_params(locals()))
336
339
  return full_result(result, typing.List[Message])
337
340
 
338
341
  async def send_location(
339
342
  self,
340
343
  chat_id: typing.Optional[typing.Union[int, str]] = None,
344
+ message_thread_id: typing.Optional[int] = None,
341
345
  latitude: typing.Optional[float] = None,
342
346
  longitude: typing.Optional[float] = None,
343
347
  horizontal_accuracy: typing.Optional[float] = None,
@@ -358,7 +362,7 @@ class APIMethods:
358
362
  ] = None,
359
363
  **other
360
364
  ) -> Result[Message, APIError]:
361
- result = await self.api.request_raw("sendLocation", self.get_params(locals()))
365
+ result = await self.api.request_raw("sendLocation", get_params(locals()))
362
366
  return full_result(result, Message)
363
367
 
364
368
  async def edit_message_live_location(
@@ -375,7 +379,7 @@ class APIMethods:
375
379
  **other
376
380
  ) -> Result[typing.Union[Message, bool], APIError]:
377
381
  result = await self.api.request_raw(
378
- "editMessageLiveLocation", self.get_params(locals())
382
+ "editMessageLiveLocation", get_params(locals())
379
383
  )
380
384
  return full_result(result, typing.Union[Message, bool])
381
385
 
@@ -388,13 +392,14 @@ class APIMethods:
388
392
  **other
389
393
  ) -> Result[typing.Union[Message, bool], APIError]:
390
394
  result = await self.api.request_raw(
391
- "stopMessageLiveLocation", self.get_params(locals())
395
+ "stopMessageLiveLocation", get_params(locals())
392
396
  )
393
397
  return full_result(result, typing.Union[Message, bool])
394
398
 
395
399
  async def send_venue(
396
400
  self,
397
401
  chat_id: typing.Optional[typing.Union[int, str]] = None,
402
+ message_thread_id: typing.Optional[int] = None,
398
403
  latitude: typing.Optional[float] = None,
399
404
  longitude: typing.Optional[float] = None,
400
405
  title: typing.Optional[str] = None,
@@ -417,12 +422,13 @@ class APIMethods:
417
422
  ] = None,
418
423
  **other
419
424
  ) -> Result[Message, APIError]:
420
- result = await self.api.request_raw("sendVenue", self.get_params(locals()))
425
+ result = await self.api.request_raw("sendVenue", get_params(locals()))
421
426
  return full_result(result, Message)
422
427
 
423
428
  async def send_contact(
424
429
  self,
425
430
  chat_id: typing.Optional[typing.Union[int, str]] = None,
431
+ message_thread_id: typing.Optional[int] = None,
426
432
  phone_number: typing.Optional[str] = None,
427
433
  first_name: typing.Optional[str] = None,
428
434
  last_name: typing.Optional[str] = None,
@@ -441,12 +447,13 @@ class APIMethods:
441
447
  ] = None,
442
448
  **other
443
449
  ) -> Result[Message, APIError]:
444
- result = await self.api.request_raw("sendContact", self.get_params(locals()))
450
+ result = await self.api.request_raw("sendContact", get_params(locals()))
445
451
  return full_result(result, Message)
446
452
 
447
453
  async def send_poll(
448
454
  self,
449
455
  chat_id: typing.Optional[typing.Union[int, str]] = None,
456
+ message_thread_id: typing.Optional[int] = None,
450
457
  question: typing.Optional[str] = None,
451
458
  options: typing.Optional[typing.List[str]] = None,
452
459
  is_anonymous: typing.Optional[bool] = None,
@@ -473,12 +480,13 @@ class APIMethods:
473
480
  ] = None,
474
481
  **other
475
482
  ) -> Result[Message, APIError]:
476
- result = await self.api.request_raw("sendPoll", self.get_params(locals()))
483
+ result = await self.api.request_raw("sendPoll", get_params(locals()))
477
484
  return full_result(result, Message)
478
485
 
479
486
  async def send_dice(
480
487
  self,
481
488
  chat_id: typing.Optional[typing.Union[int, str]] = None,
489
+ message_thread_id: typing.Optional[int] = None,
482
490
  emoji: typing.Optional[str] = None,
483
491
  disable_notification: typing.Optional[bool] = None,
484
492
  protect_content: typing.Optional[bool] = None,
@@ -494,7 +502,7 @@ class APIMethods:
494
502
  ] = None,
495
503
  **other
496
504
  ) -> Result[Message, APIError]:
497
- result = await self.api.request_raw("sendDice", self.get_params(locals()))
505
+ result = await self.api.request_raw("sendDice", get_params(locals()))
498
506
  return full_result(result, Message)
499
507
 
500
508
  async def send_chat_action(
@@ -503,7 +511,7 @@ class APIMethods:
503
511
  action: typing.Optional[str] = None,
504
512
  **other
505
513
  ) -> Result[bool, APIError]:
506
- result = await self.api.request_raw("sendChatAction", self.get_params(locals()))
514
+ result = await self.api.request_raw("sendChatAction", get_params(locals()))
507
515
  return full_result(result, bool)
508
516
 
509
517
  async def get_user_profile_photos(
@@ -514,14 +522,14 @@ class APIMethods:
514
522
  **other
515
523
  ) -> Result[UserProfilePhotos, APIError]:
516
524
  result = await self.api.request_raw(
517
- "getUserProfilePhotos", self.get_params(locals())
525
+ "getUserProfilePhotos", get_params(locals())
518
526
  )
519
527
  return full_result(result, UserProfilePhotos)
520
528
 
521
529
  async def get_file(
522
530
  self, file_id: typing.Optional[str] = None, **other
523
531
  ) -> Result[File, APIError]:
524
- result = await self.api.request_raw("getFile", self.get_params(locals()))
532
+ result = await self.api.request_raw("getFile", get_params(locals()))
525
533
  return full_result(result, File)
526
534
 
527
535
  async def ban_chat_member(
@@ -532,7 +540,7 @@ class APIMethods:
532
540
  revoke_messages: typing.Optional[bool] = None,
533
541
  **other
534
542
  ) -> Result[bool, APIError]:
535
- result = await self.api.request_raw("banChatMember", self.get_params(locals()))
543
+ result = await self.api.request_raw("banChatMember", get_params(locals()))
536
544
  return full_result(result, bool)
537
545
 
538
546
  async def unban_chat_member(
@@ -542,9 +550,7 @@ class APIMethods:
542
550
  only_if_banned: typing.Optional[bool] = None,
543
551
  **other
544
552
  ) -> Result[bool, APIError]:
545
- result = await self.api.request_raw(
546
- "unbanChatMember", self.get_params(locals())
547
- )
553
+ result = await self.api.request_raw("unbanChatMember", get_params(locals()))
548
554
  return full_result(result, bool)
549
555
 
550
556
  async def restrict_chat_member(
@@ -555,9 +561,7 @@ class APIMethods:
555
561
  until_date: typing.Optional[int] = None,
556
562
  **other
557
563
  ) -> Result[bool, APIError]:
558
- result = await self.api.request_raw(
559
- "restrictChatMember", self.get_params(locals())
560
- )
564
+ result = await self.api.request_raw("restrictChatMember", get_params(locals()))
561
565
  return full_result(result, bool)
562
566
 
563
567
  async def promote_chat_member(
@@ -575,11 +579,10 @@ class APIMethods:
575
579
  can_change_info: typing.Optional[bool] = None,
576
580
  can_invite_users: typing.Optional[bool] = None,
577
581
  can_pin_messages: typing.Optional[bool] = None,
582
+ can_manage_topics: typing.Optional[bool] = None,
578
583
  **other
579
584
  ) -> Result[bool, APIError]:
580
- result = await self.api.request_raw(
581
- "promoteChatMember", self.get_params(locals())
582
- )
585
+ result = await self.api.request_raw("promoteChatMember", get_params(locals()))
583
586
  return full_result(result, bool)
584
587
 
585
588
  async def set_chat_administrator_custom_title(
@@ -590,7 +593,7 @@ class APIMethods:
590
593
  **other
591
594
  ) -> Result[bool, APIError]:
592
595
  result = await self.api.request_raw(
593
- "setChatAdministratorCustomTitle", self.get_params(locals())
596
+ "setChatAdministratorCustomTitle", get_params(locals())
594
597
  )
595
598
  return full_result(result, bool)
596
599
 
@@ -600,9 +603,7 @@ class APIMethods:
600
603
  sender_chat_id: typing.Optional[int] = None,
601
604
  **other
602
605
  ) -> Result[bool, APIError]:
603
- result = await self.api.request_raw(
604
- "banChatSenderChat", self.get_params(locals())
605
- )
606
+ result = await self.api.request_raw("banChatSenderChat", get_params(locals()))
606
607
  return full_result(result, bool)
607
608
 
608
609
  async def unban_chat_sender_chat(
@@ -611,9 +612,7 @@ class APIMethods:
611
612
  sender_chat_id: typing.Optional[int] = None,
612
613
  **other
613
614
  ) -> Result[bool, APIError]:
614
- result = await self.api.request_raw(
615
- "unbanChatSenderChat", self.get_params(locals())
616
- )
615
+ result = await self.api.request_raw("unbanChatSenderChat", get_params(locals()))
617
616
  return full_result(result, bool)
618
617
 
619
618
  async def set_chat_permissions(
@@ -622,16 +621,14 @@ class APIMethods:
622
621
  permissions: typing.Optional[ChatPermissions] = None,
623
622
  **other
624
623
  ) -> Result[bool, APIError]:
625
- result = await self.api.request_raw(
626
- "setChatPermissions", self.get_params(locals())
627
- )
624
+ result = await self.api.request_raw("setChatPermissions", get_params(locals()))
628
625
  return full_result(result, bool)
629
626
 
630
627
  async def export_chat_invite_link(
631
628
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
632
629
  ) -> Result[str, APIError]:
633
630
  result = await self.api.request_raw(
634
- "exportChatInviteLink", self.get_params(locals())
631
+ "exportChatInviteLink", get_params(locals())
635
632
  )
636
633
  return full_result(result, str)
637
634
 
@@ -645,7 +642,7 @@ class APIMethods:
645
642
  **other
646
643
  ) -> Result[ChatInviteLink, APIError]:
647
644
  result = await self.api.request_raw(
648
- "createChatInviteLink", self.get_params(locals())
645
+ "createChatInviteLink", get_params(locals())
649
646
  )
650
647
  return full_result(result, ChatInviteLink)
651
648
 
@@ -659,9 +656,7 @@ class APIMethods:
659
656
  creates_join_request: typing.Optional[bool] = None,
660
657
  **other
661
658
  ) -> Result[ChatInviteLink, APIError]:
662
- result = await self.api.request_raw(
663
- "editChatInviteLink", self.get_params(locals())
664
- )
659
+ result = await self.api.request_raw("editChatInviteLink", get_params(locals()))
665
660
  return full_result(result, ChatInviteLink)
666
661
 
667
662
  async def revoke_chat_invite_link(
@@ -671,7 +666,7 @@ class APIMethods:
671
666
  **other
672
667
  ) -> Result[ChatInviteLink, APIError]:
673
668
  result = await self.api.request_raw(
674
- "revokeChatInviteLink", self.get_params(locals())
669
+ "revokeChatInviteLink", get_params(locals())
675
670
  )
676
671
  return full_result(result, ChatInviteLink)
677
672
 
@@ -682,7 +677,7 @@ class APIMethods:
682
677
  **other
683
678
  ) -> Result[bool, APIError]:
684
679
  result = await self.api.request_raw(
685
- "approveChatJoinRequest", self.get_params(locals())
680
+ "approveChatJoinRequest", get_params(locals())
686
681
  )
687
682
  return full_result(result, bool)
688
683
 
@@ -693,7 +688,7 @@ class APIMethods:
693
688
  **other
694
689
  ) -> Result[bool, APIError]:
695
690
  result = await self.api.request_raw(
696
- "declineChatJoinRequest", self.get_params(locals())
691
+ "declineChatJoinRequest", get_params(locals())
697
692
  )
698
693
  return full_result(result, bool)
699
694
 
@@ -703,15 +698,13 @@ class APIMethods:
703
698
  photo: typing.Optional[InputFile] = None,
704
699
  **other
705
700
  ) -> Result[bool, APIError]:
706
- result = await self.api.request_raw("setChatPhoto", self.get_params(locals()))
701
+ result = await self.api.request_raw("setChatPhoto", get_params(locals()))
707
702
  return full_result(result, bool)
708
703
 
709
704
  async def delete_chat_photo(
710
705
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
711
706
  ) -> Result[bool, APIError]:
712
- result = await self.api.request_raw(
713
- "deleteChatPhoto", self.get_params(locals())
714
- )
707
+ result = await self.api.request_raw("deleteChatPhoto", get_params(locals()))
715
708
  return full_result(result, bool)
716
709
 
717
710
  async def set_chat_title(
@@ -720,7 +713,7 @@ class APIMethods:
720
713
  title: typing.Optional[str] = None,
721
714
  **other
722
715
  ) -> Result[bool, APIError]:
723
- result = await self.api.request_raw("setChatTitle", self.get_params(locals()))
716
+ result = await self.api.request_raw("setChatTitle", get_params(locals()))
724
717
  return full_result(result, bool)
725
718
 
726
719
  async def set_chat_description(
@@ -729,9 +722,7 @@ class APIMethods:
729
722
  description: typing.Optional[str] = None,
730
723
  **other
731
724
  ) -> Result[bool, APIError]:
732
- result = await self.api.request_raw(
733
- "setChatDescription", self.get_params(locals())
734
- )
725
+ result = await self.api.request_raw("setChatDescription", get_params(locals()))
735
726
  return full_result(result, bool)
736
727
 
737
728
  async def pin_chat_message(
@@ -741,7 +732,7 @@ class APIMethods:
741
732
  disable_notification: typing.Optional[bool] = None,
742
733
  **other
743
734
  ) -> Result[bool, APIError]:
744
- result = await self.api.request_raw("pinChatMessage", self.get_params(locals()))
735
+ result = await self.api.request_raw("pinChatMessage", get_params(locals()))
745
736
  return full_result(result, bool)
746
737
 
747
738
  async def unpin_chat_message(
@@ -750,45 +741,41 @@ class APIMethods:
750
741
  message_id: typing.Optional[int] = None,
751
742
  **other
752
743
  ) -> Result[bool, APIError]:
753
- result = await self.api.request_raw(
754
- "unpinChatMessage", self.get_params(locals())
755
- )
744
+ result = await self.api.request_raw("unpinChatMessage", get_params(locals()))
756
745
  return full_result(result, bool)
757
746
 
758
747
  async def unpin_all_chat_messages(
759
748
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
760
749
  ) -> Result[bool, APIError]:
761
750
  result = await self.api.request_raw(
762
- "unpinAllChatMessages", self.get_params(locals())
751
+ "unpinAllChatMessages", get_params(locals())
763
752
  )
764
753
  return full_result(result, bool)
765
754
 
766
755
  async def leave_chat(
767
756
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
768
757
  ) -> Result[bool, APIError]:
769
- result = await self.api.request_raw("leaveChat", self.get_params(locals()))
758
+ result = await self.api.request_raw("leaveChat", get_params(locals()))
770
759
  return full_result(result, bool)
771
760
 
772
761
  async def get_chat(
773
762
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
774
763
  ) -> Result[Chat, APIError]:
775
- result = await self.api.request_raw("getChat", self.get_params(locals()))
764
+ result = await self.api.request_raw("getChat", get_params(locals()))
776
765
  return full_result(result, Chat)
777
766
 
778
767
  async def get_chat_administrators(
779
768
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
780
769
  ) -> Result[typing.List[ChatMember], APIError]:
781
770
  result = await self.api.request_raw(
782
- "getChatAdministrators", self.get_params(locals())
771
+ "getChatAdministrators", get_params(locals())
783
772
  )
784
773
  return full_result(result, typing.List[ChatMember])
785
774
 
786
775
  async def get_chat_member_count(
787
776
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
788
777
  ) -> Result[int, APIError]:
789
- result = await self.api.request_raw(
790
- "getChatMemberCount", self.get_params(locals())
791
- )
778
+ result = await self.api.request_raw("getChatMemberCount", get_params(locals()))
792
779
  return full_result(result, int)
793
780
 
794
781
  async def get_chat_member(
@@ -797,7 +784,7 @@ class APIMethods:
797
784
  user_id: typing.Optional[int] = None,
798
785
  **other
799
786
  ) -> Result[ChatMember, APIError]:
800
- result = await self.api.request_raw("getChatMember", self.get_params(locals()))
787
+ result = await self.api.request_raw("getChatMember", get_params(locals()))
801
788
  return full_result(result, ChatMember)
802
789
 
803
790
  async def set_chat_sticker_set(
@@ -806,16 +793,82 @@ class APIMethods:
806
793
  sticker_set_name: typing.Optional[str] = None,
807
794
  **other
808
795
  ) -> Result[bool, APIError]:
809
- result = await self.api.request_raw(
810
- "setChatStickerSet", self.get_params(locals())
811
- )
796
+ result = await self.api.request_raw("setChatStickerSet", get_params(locals()))
812
797
  return full_result(result, bool)
813
798
 
814
799
  async def delete_chat_sticker_set(
815
800
  self, chat_id: typing.Optional[typing.Union[int, str]] = None, **other
816
801
  ) -> Result[bool, APIError]:
817
802
  result = await self.api.request_raw(
818
- "deleteChatStickerSet", self.get_params(locals())
803
+ "deleteChatStickerSet", get_params(locals())
804
+ )
805
+ return full_result(result, bool)
806
+
807
+ async def get_forum_topic_icon_stickers(
808
+ self, **other
809
+ ) -> Result[typing.List[Sticker], APIError]:
810
+ result = await self.api.request_raw(
811
+ "getForumTopicIconStickers", get_params(locals())
812
+ )
813
+ return full_result(result, typing.List[Sticker])
814
+
815
+ async def create_forum_topic(
816
+ self,
817
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
818
+ name: typing.Optional[str] = None,
819
+ icon_color: typing.Optional[int] = None,
820
+ icon_custom_emoji_id: typing.Optional[str] = None,
821
+ **other
822
+ ) -> Result[ForumTopic, APIError]:
823
+ result = await self.api.request_raw("createForumTopic", get_params(locals()))
824
+ return full_result(result, ForumTopic)
825
+
826
+ async def edit_forum_topic(
827
+ self,
828
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
829
+ message_thread_id: typing.Optional[int] = None,
830
+ name: typing.Optional[str] = None,
831
+ icon_custom_emoji_id: typing.Optional[str] = None,
832
+ **other
833
+ ) -> Result[bool, APIError]:
834
+ result = await self.api.request_raw("editForumTopic", get_params(locals()))
835
+ return full_result(result, bool)
836
+
837
+ async def close_forum_topic(
838
+ self,
839
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
840
+ message_thread_id: typing.Optional[int] = None,
841
+ **other
842
+ ) -> Result[bool, APIError]:
843
+ result = await self.api.request_raw("closeForumTopic", get_params(locals()))
844
+ return full_result(result, bool)
845
+
846
+ async def reopen_forum_topic(
847
+ self,
848
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
849
+ message_thread_id: typing.Optional[int] = None,
850
+ **other
851
+ ) -> Result[bool, APIError]:
852
+ result = await self.api.request_raw("reopenForumTopic", get_params(locals()))
853
+ return full_result(result, bool)
854
+
855
+ async def delete_forum_topic(
856
+ self,
857
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
858
+ message_thread_id: typing.Optional[int] = None,
859
+ **other
860
+ ) -> Result[bool, APIError]:
861
+ result = await self.api.request_raw("deleteForumTopic", get_params(locals()))
862
+ return full_result(result, bool)
863
+
864
+ async def unpin_all_forum_topic_messages(
865
+ self,
866
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
867
+ message_thread_id: typing.Optional[int] = None,
868
+ **other
869
+ ) -> Result[bool, APIError]:
870
+ result = await self.api.request_raw(
871
+ "unpinAllForumTopicMessages", get_params(locals())
819
872
  )
820
873
  return full_result(result, bool)
821
874
 
@@ -828,9 +881,7 @@ class APIMethods:
828
881
  cache_time: typing.Optional[int] = None,
829
882
  **other
830
883
  ) -> Result[bool, APIError]:
831
- result = await self.api.request_raw(
832
- "answerCallbackQuery", self.get_params(locals())
833
- )
884
+ result = await self.api.request_raw("answerCallbackQuery", get_params(locals()))
834
885
  return full_result(result, bool)
835
886
 
836
887
  async def set_my_commands(
@@ -840,7 +891,7 @@ class APIMethods:
840
891
  language_code: typing.Optional[str] = None,
841
892
  **other
842
893
  ) -> Result[bool, APIError]:
843
- result = await self.api.request_raw("setMyCommands", self.get_params(locals()))
894
+ result = await self.api.request_raw("setMyCommands", get_params(locals()))
844
895
  return full_result(result, bool)
845
896
 
846
897
  async def delete_my_commands(
@@ -849,9 +900,7 @@ class APIMethods:
849
900
  language_code: typing.Optional[str] = None,
850
901
  **other
851
902
  ) -> Result[bool, APIError]:
852
- result = await self.api.request_raw(
853
- "deleteMyCommands", self.get_params(locals())
854
- )
903
+ result = await self.api.request_raw("deleteMyCommands", get_params(locals()))
855
904
  return full_result(result, bool)
856
905
 
857
906
  async def get_my_commands(
@@ -860,7 +909,7 @@ class APIMethods:
860
909
  language_code: typing.Optional[str] = None,
861
910
  **other
862
911
  ) -> Result[typing.List[BotCommand], APIError]:
863
- result = await self.api.request_raw("getMyCommands", self.get_params(locals()))
912
+ result = await self.api.request_raw("getMyCommands", get_params(locals()))
864
913
  return full_result(result, typing.List[BotCommand])
865
914
 
866
915
  async def set_chat_menu_button(
@@ -869,17 +918,13 @@ class APIMethods:
869
918
  menu_button: typing.Optional[MenuButton] = None,
870
919
  **other
871
920
  ) -> Result[bool, APIError]:
872
- result = await self.api.request_raw(
873
- "setChatMenuButton", self.get_params(locals())
874
- )
921
+ result = await self.api.request_raw("setChatMenuButton", get_params(locals()))
875
922
  return full_result(result, bool)
876
923
 
877
924
  async def get_chat_menu_button(
878
925
  self, chat_id: typing.Optional[int] = None, **other
879
926
  ) -> Result[MenuButton, APIError]:
880
- result = await self.api.request_raw(
881
- "getChatMenuButton", self.get_params(locals())
882
- )
927
+ result = await self.api.request_raw("getChatMenuButton", get_params(locals()))
883
928
  return full_result(result, MenuButton)
884
929
 
885
930
  async def set_my_default_administrator_rights(
@@ -889,7 +934,7 @@ class APIMethods:
889
934
  **other
890
935
  ) -> Result[bool, APIError]:
891
936
  result = await self.api.request_raw(
892
- "setMyDefaultAdministratorRights", self.get_params(locals())
937
+ "setMyDefaultAdministratorRights", get_params(locals())
893
938
  )
894
939
  return full_result(result, bool)
895
940
 
@@ -897,7 +942,7 @@ class APIMethods:
897
942
  self, for_channels: typing.Optional[bool] = None, **other
898
943
  ) -> Result[ChatAdministratorRights, APIError]:
899
944
  result = await self.api.request_raw(
900
- "getMyDefaultAdministratorRights", self.get_params(locals())
945
+ "getMyDefaultAdministratorRights", get_params(locals())
901
946
  )
902
947
  return full_result(result, ChatAdministratorRights)
903
948
 
@@ -913,9 +958,7 @@ class APIMethods:
913
958
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
914
959
  **other
915
960
  ) -> Result[typing.Union[Message, bool], APIError]:
916
- result = await self.api.request_raw(
917
- "editMessageText", self.get_params(locals())
918
- )
961
+ result = await self.api.request_raw("editMessageText", get_params(locals()))
919
962
  return full_result(result, typing.Union[Message, bool])
920
963
 
921
964
  async def edit_message_caption(
@@ -929,9 +972,7 @@ class APIMethods:
929
972
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
930
973
  **other
931
974
  ) -> Result[typing.Union[Message, bool], APIError]:
932
- result = await self.api.request_raw(
933
- "editMessageCaption", self.get_params(locals())
934
- )
975
+ result = await self.api.request_raw("editMessageCaption", get_params(locals()))
935
976
  return full_result(result, typing.Union[Message, bool])
936
977
 
937
978
  async def edit_message_media(
@@ -943,9 +984,7 @@ class APIMethods:
943
984
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
944
985
  **other
945
986
  ) -> Result[typing.Union[Message, bool], APIError]:
946
- result = await self.api.request_raw(
947
- "editMessageMedia", self.get_params(locals())
948
- )
987
+ result = await self.api.request_raw("editMessageMedia", get_params(locals()))
949
988
  return full_result(result, typing.Union[Message, bool])
950
989
 
951
990
  async def edit_message_reply_markup(
@@ -957,7 +996,7 @@ class APIMethods:
957
996
  **other
958
997
  ) -> Result[typing.Union[Message, bool], APIError]:
959
998
  result = await self.api.request_raw(
960
- "editMessageReplyMarkup", self.get_params(locals())
999
+ "editMessageReplyMarkup", get_params(locals())
961
1000
  )
962
1001
  return full_result(result, typing.Union[Message, bool])
963
1002
 
@@ -968,7 +1007,7 @@ class APIMethods:
968
1007
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
969
1008
  **other
970
1009
  ) -> Result[Poll, APIError]:
971
- result = await self.api.request_raw("stopPoll", self.get_params(locals()))
1010
+ result = await self.api.request_raw("stopPoll", get_params(locals()))
972
1011
  return full_result(result, Poll)
973
1012
 
974
1013
  async def delete_message(
@@ -977,12 +1016,13 @@ class APIMethods:
977
1016
  message_id: typing.Optional[int] = None,
978
1017
  **other
979
1018
  ) -> Result[bool, APIError]:
980
- result = await self.api.request_raw("deleteMessage", self.get_params(locals()))
1019
+ result = await self.api.request_raw("deleteMessage", get_params(locals()))
981
1020
  return full_result(result, bool)
982
1021
 
983
1022
  async def send_sticker(
984
1023
  self,
985
1024
  chat_id: typing.Optional[typing.Union[int, str]] = None,
1025
+ message_thread_id: typing.Optional[int] = None,
986
1026
  sticker: typing.Optional[typing.Union[InputFile, str]] = None,
987
1027
  disable_notification: typing.Optional[bool] = None,
988
1028
  protect_content: typing.Optional[bool] = None,
@@ -998,20 +1038,20 @@ class APIMethods:
998
1038
  ] = None,
999
1039
  **other
1000
1040
  ) -> Result[Message, APIError]:
1001
- result = await self.api.request_raw("sendSticker", self.get_params(locals()))
1041
+ result = await self.api.request_raw("sendSticker", get_params(locals()))
1002
1042
  return full_result(result, Message)
1003
1043
 
1004
1044
  async def get_sticker_set(
1005
1045
  self, name: typing.Optional[str] = None, **other
1006
1046
  ) -> Result[StickerSet, APIError]:
1007
- result = await self.api.request_raw("getStickerSet", self.get_params(locals()))
1047
+ result = await self.api.request_raw("getStickerSet", get_params(locals()))
1008
1048
  return full_result(result, StickerSet)
1009
1049
 
1010
1050
  async def get_custom_emoji_stickers(
1011
1051
  self, custom_emoji_ids: typing.Optional[typing.List[str]] = None, **other
1012
1052
  ) -> Result[typing.List[Sticker], APIError]:
1013
1053
  result = await self.api.request_raw(
1014
- "getCustomEmojiStickers", self.get_params(locals())
1054
+ "getCustomEmojiStickers", get_params(locals())
1015
1055
  )
1016
1056
  return full_result(result, typing.List[Sticker])
1017
1057
 
@@ -1021,9 +1061,7 @@ class APIMethods:
1021
1061
  png_sticker: typing.Optional[InputFile] = None,
1022
1062
  **other
1023
1063
  ) -> Result[File, APIError]:
1024
- result = await self.api.request_raw(
1025
- "uploadStickerFile", self.get_params(locals())
1026
- )
1064
+ result = await self.api.request_raw("uploadStickerFile", get_params(locals()))
1027
1065
  return full_result(result, File)
1028
1066
 
1029
1067
  async def create_new_sticker_set(
@@ -1039,9 +1077,7 @@ class APIMethods:
1039
1077
  mask_position: typing.Optional[MaskPosition] = None,
1040
1078
  **other
1041
1079
  ) -> Result[bool, APIError]:
1042
- result = await self.api.request_raw(
1043
- "createNewStickerSet", self.get_params(locals())
1044
- )
1080
+ result = await self.api.request_raw("createNewStickerSet", get_params(locals()))
1045
1081
  return full_result(result, bool)
1046
1082
 
1047
1083
  async def add_sticker_to_set(
@@ -1055,9 +1091,7 @@ class APIMethods:
1055
1091
  mask_position: typing.Optional[MaskPosition] = None,
1056
1092
  **other
1057
1093
  ) -> Result[bool, APIError]:
1058
- result = await self.api.request_raw(
1059
- "addStickerToSet", self.get_params(locals())
1060
- )
1094
+ result = await self.api.request_raw("addStickerToSet", get_params(locals()))
1061
1095
  return full_result(result, bool)
1062
1096
 
1063
1097
  async def set_sticker_position_in_set(
@@ -1067,7 +1101,7 @@ class APIMethods:
1067
1101
  **other
1068
1102
  ) -> Result[bool, APIError]:
1069
1103
  result = await self.api.request_raw(
1070
- "setStickerPositionInSet", self.get_params(locals())
1104
+ "setStickerPositionInSet", get_params(locals())
1071
1105
  )
1072
1106
  return full_result(result, bool)
1073
1107
 
@@ -1075,7 +1109,7 @@ class APIMethods:
1075
1109
  self, sticker: typing.Optional[str] = None, **other
1076
1110
  ) -> Result[bool, APIError]:
1077
1111
  result = await self.api.request_raw(
1078
- "deleteStickerFromSet", self.get_params(locals())
1112
+ "deleteStickerFromSet", get_params(locals())
1079
1113
  )
1080
1114
  return full_result(result, bool)
1081
1115
 
@@ -1086,9 +1120,7 @@ class APIMethods:
1086
1120
  thumb: typing.Optional[typing.Union[InputFile, str]] = None,
1087
1121
  **other
1088
1122
  ) -> Result[bool, APIError]:
1089
- result = await self.api.request_raw(
1090
- "setStickerSetThumb", self.get_params(locals())
1091
- )
1123
+ result = await self.api.request_raw("setStickerSetThumb", get_params(locals()))
1092
1124
  return full_result(result, bool)
1093
1125
 
1094
1126
  async def answer_inline_query(
@@ -1102,9 +1134,7 @@ class APIMethods:
1102
1134
  switch_pm_parameter: typing.Optional[str] = None,
1103
1135
  **other
1104
1136
  ) -> Result[bool, APIError]:
1105
- result = await self.api.request_raw(
1106
- "answerInlineQuery", self.get_params(locals())
1107
- )
1137
+ result = await self.api.request_raw("answerInlineQuery", get_params(locals()))
1108
1138
  return full_result(result, bool)
1109
1139
 
1110
1140
  async def answer_web_app_query(
@@ -1113,14 +1143,13 @@ class APIMethods:
1113
1143
  result: typing.Optional[InlineQueryResult] = None,
1114
1144
  **other
1115
1145
  ) -> Result[SentWebAppMessage, APIError]:
1116
- result = await self.api.request_raw(
1117
- "answerWebAppQuery", self.get_params(locals())
1118
- )
1146
+ result = await self.api.request_raw("answerWebAppQuery", get_params(locals()))
1119
1147
  return full_result(result, SentWebAppMessage)
1120
1148
 
1121
1149
  async def send_invoice(
1122
1150
  self,
1123
1151
  chat_id: typing.Optional[typing.Union[int, str]] = None,
1152
+ message_thread_id: typing.Optional[int] = None,
1124
1153
  title: typing.Optional[str] = None,
1125
1154
  description: typing.Optional[str] = None,
1126
1155
  payload: typing.Optional[str] = None,
@@ -1149,7 +1178,7 @@ class APIMethods:
1149
1178
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
1150
1179
  **other
1151
1180
  ) -> Result[Message, APIError]:
1152
- result = await self.api.request_raw("sendInvoice", self.get_params(locals()))
1181
+ result = await self.api.request_raw("sendInvoice", get_params(locals()))
1153
1182
  return full_result(result, Message)
1154
1183
 
1155
1184
  async def create_invoice_link(
@@ -1176,9 +1205,7 @@ class APIMethods:
1176
1205
  is_flexible: typing.Optional[bool] = None,
1177
1206
  **other
1178
1207
  ) -> Result[str, APIError]:
1179
- result = await self.api.request_raw(
1180
- "createInvoiceLink", self.get_params(locals())
1181
- )
1208
+ result = await self.api.request_raw("createInvoiceLink", get_params(locals()))
1182
1209
  return full_result(result, str)
1183
1210
 
1184
1211
  async def answer_shipping_query(
@@ -1189,9 +1216,7 @@ class APIMethods:
1189
1216
  error_message: typing.Optional[str] = None,
1190
1217
  **other
1191
1218
  ) -> Result[bool, APIError]:
1192
- result = await self.api.request_raw(
1193
- "answerShippingQuery", self.get_params(locals())
1194
- )
1219
+ result = await self.api.request_raw("answerShippingQuery", get_params(locals()))
1195
1220
  return full_result(result, bool)
1196
1221
 
1197
1222
  async def answer_pre_checkout_query(
@@ -1202,7 +1227,7 @@ class APIMethods:
1202
1227
  **other
1203
1228
  ) -> Result[bool, APIError]:
1204
1229
  result = await self.api.request_raw(
1205
- "answerPreCheckoutQuery", self.get_params(locals())
1230
+ "answerPreCheckoutQuery", get_params(locals())
1206
1231
  )
1207
1232
  return full_result(result, bool)
1208
1233
 
@@ -1213,13 +1238,14 @@ class APIMethods:
1213
1238
  **other
1214
1239
  ) -> Result[bool, APIError]:
1215
1240
  result = await self.api.request_raw(
1216
- "setPassportDataErrors", self.get_params(locals())
1241
+ "setPassportDataErrors", get_params(locals())
1217
1242
  )
1218
1243
  return full_result(result, bool)
1219
1244
 
1220
1245
  async def send_game(
1221
1246
  self,
1222
1247
  chat_id: typing.Optional[int] = None,
1248
+ message_thread_id: typing.Optional[int] = None,
1223
1249
  game_short_name: typing.Optional[str] = None,
1224
1250
  disable_notification: typing.Optional[bool] = None,
1225
1251
  protect_content: typing.Optional[bool] = None,
@@ -1228,7 +1254,7 @@ class APIMethods:
1228
1254
  reply_markup: typing.Optional[InlineKeyboardMarkup] = None,
1229
1255
  **other
1230
1256
  ) -> Result[Message, APIError]:
1231
- result = await self.api.request_raw("sendGame", self.get_params(locals()))
1257
+ result = await self.api.request_raw("sendGame", get_params(locals()))
1232
1258
  return full_result(result, Message)
1233
1259
 
1234
1260
  async def set_game_score(
@@ -1242,7 +1268,7 @@ class APIMethods:
1242
1268
  inline_message_id: typing.Optional[str] = None,
1243
1269
  **other
1244
1270
  ) -> Result[typing.Union[Message, bool], APIError]:
1245
- result = await self.api.request_raw("setGameScore", self.get_params(locals()))
1271
+ result = await self.api.request_raw("setGameScore", get_params(locals()))
1246
1272
  return full_result(result, typing.Union[Message, bool])
1247
1273
 
1248
1274
  async def get_game_high_scores(
@@ -1253,7 +1279,5 @@ class APIMethods:
1253
1279
  inline_message_id: typing.Optional[str] = None,
1254
1280
  **other
1255
1281
  ) -> Result[typing.List[GameHighScore], APIError]:
1256
- result = await self.api.request_raw(
1257
- "getGameHighScores", self.get_params(locals())
1258
- )
1282
+ result = await self.api.request_raw("getGameHighScores", get_params(locals()))
1259
1283
  return full_result(result, typing.List[GameHighScore])