botapi-py 1.5.7__tar.gz → 1.5.9__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: botapi-py
3
- Version: 1.5.7
3
+ Version: 1.5.9
4
4
  Summary: A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API.
5
5
  Requires-Dist: httpx>=0.28.1
6
6
  Requires-Dist: pydantic>=2.12.0
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "botapi-py"
3
- version = "1.5.7"
3
+ version = "1.5.9"
4
4
  description = "A simple and flexible Python library to conveniently build fast Telegram bots using the Bot API."
5
5
  # readme = "README.md"
6
6
  # authors = [
@@ -42,6 +42,8 @@ class UpdateType(enum.StrEnum):
42
42
  EDITED_BUSINESS_MESSAGE = 'edited_business_message'
43
43
  DELETED_BUSINESS_MESSAGES = 'deleted_business_messages'
44
44
  PURCHASED_PAID_MEDIA = 'purchased_paid_media'
45
+ MANAGED_BOT = 'managed_bot'
46
+ GUEST_MESSAGE = 'guest_message'
45
47
 
46
48
  class MediaType(enum.StrEnum):
47
49
  '''
@@ -59,6 +61,7 @@ class MediaType(enum.StrEnum):
59
61
  VOICE = 'voice'
60
62
  STORY = 'story' # does not have `file_id`, only `id`
61
63
  PAID_MEDIA = 'paid_media' # this contains a `photo` attribute that is a list of `PhotoSize` objects
64
+ LIVE_PHOTO = 'live_photo'
62
65
 
63
66
  class ServiceMessage(enum.StrEnum):
64
67
  '''
@@ -37,6 +37,7 @@ from .types import (
37
37
  Animation,
38
38
  Audio,
39
39
  Document,
40
+ LivePhoto,
40
41
  Story,
41
42
  VideoQuality,
42
43
  Video,
@@ -46,11 +47,19 @@ from .types import (
46
47
  PaidMedia,
47
48
  _PaidMedia,
48
49
  PaidMediaAdapter,
49
- PaidMediaPreview,
50
+ PaidMediaLivePhoto,
50
51
  PaidMediaPhoto,
52
+ PaidMediaPreview,
51
53
  PaidMediaVideo,
52
54
  Contact,
53
55
  Dice,
56
+ PollMedia,
57
+ InputPollMedia,
58
+ _InputPollMedia,
59
+ InputPollMediaAdapter,
60
+ InputPollOptionMedia,
61
+ _InputPollOptionMedia,
62
+ InputPollOptionMediaAdapter,
54
63
  PollOption,
55
64
  InputPollOption,
56
65
  PollAnswer,
@@ -66,6 +75,10 @@ from .types import (
66
75
  WebAppData,
67
76
  ProximityAlertTriggered,
68
77
  MessageAutoDeleteTimerChanged,
78
+ ManagedBotCreated,
79
+ ManagedBotUpdated,
80
+ PollOptionAdded,
81
+ PollOptionDeleted,
69
82
  ChatBoostAdded,
70
83
  BackgroundFill,
71
84
  _BackgroundFill,
@@ -119,6 +132,7 @@ from .types import (
119
132
  KeyboardButton,
120
133
  KeyboardButtonRequestUsers,
121
134
  KeyboardButtonRequestChat,
135
+ KeyboardButtonRequestManagedBot,
122
136
  KeyboardButtonPollType,
123
137
  ReplyKeyboardRemove,
124
138
  InlineKeyboardMarkup,
@@ -188,6 +202,7 @@ from .types import (
188
202
  OwnedGiftRegular,
189
203
  OwnedGiftUnique,
190
204
  OwnedGifts,
205
+ BotAccessSettings,
191
206
  AcceptedGiftTypes,
192
207
  StarAmount,
193
208
  BotCommand,
@@ -225,19 +240,28 @@ from .types import (
225
240
  BusinessBotRights,
226
241
  BusinessConnection,
227
242
  BusinessMessagesDeleted,
243
+ SentWebAppMessage,
244
+ SentGuestMessage,
245
+ PreparedInlineMessage,
246
+ PreparedKeyboardButton,
228
247
  ResponseParameters,
229
248
  InputMedia,
230
249
  _InputMedia,
231
250
  InputMediaAdapter,
232
- InputMediaPhoto,
233
- InputMediaVideo,
234
251
  InputMediaAnimation,
235
252
  InputMediaAudio,
236
253
  InputMediaDocument,
254
+ InputMediaLivePhoto,
255
+ InputMediaLocation,
256
+ InputMediaPhoto,
257
+ InputMediaSticker,
258
+ InputMediaVenue,
259
+ InputMediaVideo,
237
260
  InputFile,
238
261
  InputPaidMedia,
239
262
  _InputPaidMedia,
240
263
  InputPaidMediaAdapter,
264
+ InputPaidMediaLivePhoto,
241
265
  InputPaidMediaPhoto,
242
266
  InputPaidMediaVideo,
243
267
  InputProfilePhoto,
@@ -288,8 +312,6 @@ from .types import (
288
312
  InputContactMessageContent,
289
313
  InputInvoiceMessageContent,
290
314
  ChosenInlineResult,
291
- SentWebAppMessage,
292
- PreparedInlineMessage,
293
315
  LabeledPrice,
294
316
  Invoice,
295
317
  ShippingAddress,
@@ -747,6 +769,56 @@ class Methods(core.BaseBot):
747
769
  })
748
770
  return Message.model_validate(response)
749
771
 
772
+ async def send_live_photo(
773
+ self,
774
+ chat_id: Union[int, str],
775
+ live_photo: Union[InputFile, str],
776
+ photo: Union[InputFile, str],
777
+ business_connection_id: Optional[str] = None,
778
+ message_thread_id: Optional[int] = None,
779
+ direct_messages_topic_id: Optional[int] = None,
780
+ caption: Optional[str] = None,
781
+ parse_mode: Optional[Union[str, enums.ParseMode]] = None,
782
+ caption_entities: Optional[List[MessageEntity]] = None,
783
+ show_caption_above_media: Optional[bool] = None,
784
+ has_spoiler: Optional[bool] = None,
785
+ disable_notification: Optional[bool] = None,
786
+ protect_content: Optional[bool] = None,
787
+ allow_paid_broadcast: Optional[bool] = None,
788
+ message_effect_id: Optional[str] = None,
789
+ suggested_post_parameters: Optional[SuggestedPostParameters] = None,
790
+ reply_parameters: Optional[ReplyParameters] = None,
791
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None,
792
+ ) -> Message:
793
+ '''
794
+ Use this method to send live photos. On
795
+ success, the sent Message is returned.
796
+
797
+ Reference: https://core.telegram.org/bots/api#sendlivephoto
798
+ '''
799
+
800
+ response = await self._send_request('sendLivePhoto', {
801
+ 'business_connection_id': business_connection_id,
802
+ 'chat_id': chat_id,
803
+ 'message_thread_id': message_thread_id,
804
+ 'direct_messages_topic_id': direct_messages_topic_id,
805
+ 'live_photo': live_photo,
806
+ 'photo': photo,
807
+ 'caption': caption,
808
+ 'parse_mode': parse_mode,
809
+ 'caption_entities': caption_entities,
810
+ 'show_caption_above_media': show_caption_above_media,
811
+ 'has_spoiler': has_spoiler,
812
+ 'disable_notification': disable_notification,
813
+ 'protect_content': protect_content,
814
+ 'allow_paid_broadcast': allow_paid_broadcast,
815
+ 'message_effect_id': message_effect_id,
816
+ 'suggested_post_parameters': suggested_post_parameters,
817
+ 'reply_parameters': reply_parameters,
818
+ 'reply_markup': reply_markup,
819
+ })
820
+ return Message.model_validate(response)
821
+
750
822
  async def send_audio(
751
823
  self,
752
824
  chat_id: Union[int, str],
@@ -1134,7 +1206,7 @@ class Methods(core.BaseBot):
1134
1206
  async def send_media_group(
1135
1207
  self,
1136
1208
  chat_id: Union[int, str],
1137
- media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaPhoto, InputMediaVideo]],
1209
+ media: List[Union[InputMediaAudio, InputMediaDocument, InputMediaLivePhoto, InputMediaPhoto, InputMediaVideo]],
1138
1210
  business_connection_id: Optional[str] = None,
1139
1211
  message_thread_id: Optional[int] = None,
1140
1212
  direct_messages_topic_id: Optional[int] = None,
@@ -1146,11 +1218,11 @@ class Methods(core.BaseBot):
1146
1218
  ) -> List[Message]:
1147
1219
  '''
1148
1220
  Use this method to send a group of
1149
- photos, videos, documents or audios as an album.
1150
- Documents and audio files can be only grouped
1151
- in an album with messages of the same
1152
- type. On success, an array of Message objects
1153
- that were sent is returned.
1221
+ photos, live photos, videos, documents or audios as
1222
+ an album. Documents and audio files can be
1223
+ only grouped in an album with messages of
1224
+ the same type. On success, an array of
1225
+ Message objects that were sent is returned.
1154
1226
 
1155
1227
  Reference: https://core.telegram.org/bots/api#sendmediagroup
1156
1228
  '''
@@ -1325,13 +1397,24 @@ class Methods(core.BaseBot):
1325
1397
  is_anonymous: Optional[bool] = None,
1326
1398
  type: Optional[str] = None,
1327
1399
  allows_multiple_answers: Optional[bool] = None,
1328
- correct_option_id: Optional[int] = None,
1400
+ allows_revoting: Optional[bool] = None,
1401
+ shuffle_options: Optional[bool] = None,
1402
+ allow_adding_options: Optional[bool] = None,
1403
+ hide_results_until_closes: Optional[bool] = None,
1404
+ members_only: Optional[bool] = None,
1405
+ country_codes: Optional[List[str]] = None,
1406
+ correct_option_ids: Optional[List[int]] = None,
1329
1407
  explanation: Optional[str] = None,
1330
1408
  explanation_parse_mode: Optional[str] = None,
1331
1409
  explanation_entities: Optional[List[MessageEntity]] = None,
1410
+ explanation_media: Optional[_InputPollMedia] = None,
1332
1411
  open_period: Optional[int] = None,
1333
1412
  close_date: Optional[int] = None,
1334
1413
  is_closed: Optional[bool] = None,
1414
+ description: Optional[str] = None,
1415
+ description_parse_mode: Optional[str] = None,
1416
+ description_entities: Optional[List[MessageEntity]] = None,
1417
+ media: Optional[_InputPollMedia] = None,
1335
1418
  disable_notification: Optional[bool] = None,
1336
1419
  protect_content: Optional[bool] = None,
1337
1420
  allow_paid_broadcast: Optional[bool] = None,
@@ -1357,13 +1440,24 @@ class Methods(core.BaseBot):
1357
1440
  'is_anonymous': is_anonymous,
1358
1441
  'type': type,
1359
1442
  'allows_multiple_answers': allows_multiple_answers,
1360
- 'correct_option_id': correct_option_id,
1443
+ 'allows_revoting': allows_revoting,
1444
+ 'shuffle_options': shuffle_options,
1445
+ 'allow_adding_options': allow_adding_options,
1446
+ 'hide_results_until_closes': hide_results_until_closes,
1447
+ 'members_only': members_only,
1448
+ 'country_codes': country_codes,
1449
+ 'correct_option_ids': correct_option_ids,
1361
1450
  'explanation': explanation,
1362
1451
  'explanation_parse_mode': explanation_parse_mode,
1363
1452
  'explanation_entities': explanation_entities,
1453
+ 'explanation_media': explanation_media,
1364
1454
  'open_period': open_period,
1365
1455
  'close_date': close_date,
1366
1456
  'is_closed': is_closed,
1457
+ 'description': description,
1458
+ 'description_parse_mode': description_parse_mode,
1459
+ 'description_entities': description_entities,
1460
+ 'media': media,
1367
1461
  'disable_notification': disable_notification,
1368
1462
  'protect_content': protect_content,
1369
1463
  'allow_paid_broadcast': allow_paid_broadcast,
@@ -1376,7 +1470,7 @@ class Methods(core.BaseBot):
1376
1470
  async def send_checklist(
1377
1471
  self,
1378
1472
  business_connection_id: str,
1379
- chat_id: int,
1473
+ chat_id: Union[int, str],
1380
1474
  checklist: InputChecklist,
1381
1475
  disable_notification: Optional[bool] = None,
1382
1476
  protect_content: Optional[bool] = None,
@@ -1447,15 +1541,19 @@ class Methods(core.BaseBot):
1447
1541
  self,
1448
1542
  chat_id: int,
1449
1543
  draft_id: int,
1450
- text: str,
1451
1544
  message_thread_id: Optional[int] = None,
1545
+ text: Optional[str] = None,
1452
1546
  parse_mode: Optional[Union[str, enums.ParseMode]] = None,
1453
1547
  entities: Optional[List[MessageEntity]] = None,
1454
1548
  ) -> bool:
1455
1549
  '''
1456
1550
  Use this method to stream a partial message
1457
1551
  to a user while the message is being
1458
- generated. Returns True on success.
1552
+ generated. Note that the streamed draft is ephemeral
1553
+ and acts as a temporary 30-second preview -
1554
+ once the output is finalized, you must call
1555
+ sendMessage with the complete message to persist it
1556
+ in the user's chat. Returns True on success.
1459
1557
 
1460
1558
  Reference: https://core.telegram.org/bots/api#sendmessagedraft
1461
1559
  '''
@@ -2257,17 +2355,19 @@ class Methods(core.BaseBot):
2257
2355
  async def get_chat_administrators(
2258
2356
  self,
2259
2357
  chat_id: Union[int, str],
2358
+ return_bots: Optional[bool] = None,
2260
2359
  ) -> List[_ChatMember]:
2261
2360
  '''
2262
2361
  Use this method to get a list of
2263
- administrators in a chat, which aren't bots. Returns
2264
- an Array of ChatMember objects.
2362
+ administrators in a chat. Returns an Array of
2363
+ ChatMember objects.
2265
2364
 
2266
2365
  Reference: https://core.telegram.org/bots/api#getchatadministrators
2267
2366
  '''
2268
2367
 
2269
2368
  response = await self._send_request('getChatAdministrators', {
2270
2369
  'chat_id': chat_id,
2370
+ 'return_bots': return_bots,
2271
2371
  })
2272
2372
  return [ChatMemberAdapter.validate_python(x) for x in response]
2273
2373
 
@@ -2308,6 +2408,27 @@ class Methods(core.BaseBot):
2308
2408
  })
2309
2409
  return ChatMemberAdapter.validate_python(response)
2310
2410
 
2411
+ async def get_user_personal_chat_messages(
2412
+ self,
2413
+ user_id: int,
2414
+ limit: int,
2415
+ ) -> List[Message]:
2416
+ '''
2417
+ Use this method to get the last messages
2418
+ from the personal chat (i.e., the chat currently
2419
+ added to their profile) of a given user.
2420
+ On success, an array of Message objects is
2421
+ returned.
2422
+
2423
+ Reference: https://core.telegram.org/bots/api#getuserpersonalchatmessages
2424
+ '''
2425
+
2426
+ response = await self._send_request('getUserPersonalChatMessages', {
2427
+ 'user_id': user_id,
2428
+ 'limit': limit,
2429
+ })
2430
+ return [Message.model_validate(x) for x in response]
2431
+
2311
2432
  async def set_chat_sticker_set(
2312
2433
  self,
2313
2434
  chat_id: Union[int, str],
@@ -2659,6 +2780,25 @@ class Methods(core.BaseBot):
2659
2780
  })
2660
2781
  return BoolAdapter.validate_python(response)
2661
2782
 
2783
+ async def answer_guest_query(
2784
+ self,
2785
+ guest_query_id: str,
2786
+ result: _InlineQueryResult,
2787
+ ) -> SentGuestMessage:
2788
+ '''
2789
+ Use this method to reply to a received
2790
+ guest message. On success, a SentGuestMessage object is
2791
+ returned.
2792
+
2793
+ Reference: https://core.telegram.org/bots/api#answerguestquery
2794
+ '''
2795
+
2796
+ response = await self._send_request('answerGuestQuery', {
2797
+ 'guest_query_id': guest_query_id,
2798
+ 'result': result,
2799
+ })
2800
+ return SentGuestMessage.model_validate(response)
2801
+
2662
2802
  async def get_user_chat_boosts(
2663
2803
  self,
2664
2804
  chat_id: Union[int, str],
@@ -2696,6 +2836,78 @@ class Methods(core.BaseBot):
2696
2836
  })
2697
2837
  return BusinessConnection.model_validate(response)
2698
2838
 
2839
+ async def get_managed_bot_token(
2840
+ self,
2841
+ user_id: int,
2842
+ ) -> str:
2843
+ '''
2844
+ Use this method to get the token of
2845
+ a managed bot. Returns the token as String
2846
+ on success.
2847
+
2848
+ Reference: https://core.telegram.org/bots/api#getmanagedbottoken
2849
+ '''
2850
+
2851
+ response = await self._send_request('getManagedBotToken', {
2852
+ 'user_id': user_id,
2853
+ })
2854
+ return StrAdapter.validate_python(response)
2855
+
2856
+ async def replace_managed_bot_token(
2857
+ self,
2858
+ user_id: int,
2859
+ ) -> str:
2860
+ '''
2861
+ Use this method to revoke the current token
2862
+ of a managed bot and generate a new
2863
+ one. Returns the new token as String on
2864
+ success.
2865
+
2866
+ Reference: https://core.telegram.org/bots/api#replacemanagedbottoken
2867
+ '''
2868
+
2869
+ response = await self._send_request('replaceManagedBotToken', {
2870
+ 'user_id': user_id,
2871
+ })
2872
+ return StrAdapter.validate_python(response)
2873
+
2874
+ async def get_managed_bot_access_settings(
2875
+ self,
2876
+ user_id: int,
2877
+ ) -> BotAccessSettings:
2878
+ '''
2879
+ Use this method to get the access settings
2880
+ of a managed bot. Returns a BotAccessSettings object
2881
+ on success.
2882
+
2883
+ Reference: https://core.telegram.org/bots/api#getmanagedbotaccesssettings
2884
+ '''
2885
+
2886
+ response = await self._send_request('getManagedBotAccessSettings', {
2887
+ 'user_id': user_id,
2888
+ })
2889
+ return BotAccessSettings.model_validate(response)
2890
+
2891
+ async def set_managed_bot_access_settings(
2892
+ self,
2893
+ user_id: int,
2894
+ is_access_restricted: bool,
2895
+ added_user_ids: Optional[List[int]] = None,
2896
+ ) -> bool:
2897
+ '''
2898
+ Use this method to change the access settings
2899
+ of a managed bot. Returns True on success.
2900
+
2901
+ Reference: https://core.telegram.org/bots/api#setmanagedbotaccesssettings
2902
+ '''
2903
+
2904
+ response = await self._send_request('setManagedBotAccessSettings', {
2905
+ 'user_id': user_id,
2906
+ 'is_access_restricted': is_access_restricted,
2907
+ 'added_user_ids': added_user_ids,
2908
+ })
2909
+ return BoolAdapter.validate_python(response)
2910
+
2699
2911
  async def set_my_commands(
2700
2912
  self,
2701
2913
  commands: List[BotCommand],
@@ -3600,6 +3812,73 @@ class Methods(core.BaseBot):
3600
3812
  })
3601
3813
  return BoolAdapter.validate_python(response)
3602
3814
 
3815
+ async def answer_web_app_query(
3816
+ self,
3817
+ web_app_query_id: str,
3818
+ result: _InlineQueryResult,
3819
+ ) -> SentWebAppMessage:
3820
+ '''
3821
+ Use this method to set the result of
3822
+ an interaction with a Web App and send
3823
+ a corresponding message on behalf of the user
3824
+ to the chat from which the query originated.
3825
+ On success, a SentWebAppMessage object is returned.
3826
+
3827
+ Reference: https://core.telegram.org/bots/api#answerwebappquery
3828
+ '''
3829
+
3830
+ response = await self._send_request('answerWebAppQuery', {
3831
+ 'web_app_query_id': web_app_query_id,
3832
+ 'result': result,
3833
+ })
3834
+ return SentWebAppMessage.model_validate(response)
3835
+
3836
+ async def save_prepared_inline_message(
3837
+ self,
3838
+ user_id: int,
3839
+ result: _InlineQueryResult,
3840
+ allow_user_chats: Optional[bool] = None,
3841
+ allow_bot_chats: Optional[bool] = None,
3842
+ allow_group_chats: Optional[bool] = None,
3843
+ allow_channel_chats: Optional[bool] = None,
3844
+ ) -> PreparedInlineMessage:
3845
+ '''
3846
+ Stores a message that can be sent by
3847
+ a user of a Mini App. Returns a
3848
+ PreparedInlineMessage object.
3849
+
3850
+ Reference: https://core.telegram.org/bots/api#savepreparedinlinemessage
3851
+ '''
3852
+
3853
+ response = await self._send_request('savePreparedInlineMessage', {
3854
+ 'user_id': user_id,
3855
+ 'result': result,
3856
+ 'allow_user_chats': allow_user_chats,
3857
+ 'allow_bot_chats': allow_bot_chats,
3858
+ 'allow_group_chats': allow_group_chats,
3859
+ 'allow_channel_chats': allow_channel_chats,
3860
+ })
3861
+ return PreparedInlineMessage.model_validate(response)
3862
+
3863
+ async def save_prepared_keyboard_button(
3864
+ self,
3865
+ user_id: int,
3866
+ button: KeyboardButton,
3867
+ ) -> PreparedKeyboardButton:
3868
+ '''
3869
+ Stores a keyboard button that can be used
3870
+ by a user within a Mini App. Returns
3871
+ a PreparedKeyboardButton object.
3872
+
3873
+ Reference: https://core.telegram.org/bots/api#savepreparedkeyboardbutton
3874
+ '''
3875
+
3876
+ response = await self._send_request('savePreparedKeyboardButton', {
3877
+ 'user_id': user_id,
3878
+ 'button': button,
3879
+ })
3880
+ return PreparedKeyboardButton.model_validate(response)
3881
+
3603
3882
  async def edit_message_text(
3604
3883
  self,
3605
3884
  text: str,
@@ -3693,22 +3972,22 @@ class Methods(core.BaseBot):
3693
3972
  ) -> Union[Message, bool]:
3694
3973
  '''
3695
3974
  Use this method to edit animation, audio, document,
3696
- photo, or video messages, or to add media
3697
- to text messages. If a message is part
3698
- of a message album, then it can be
3699
- edited only to an audio for audio albums,
3700
- only to a document for document albums and
3701
- to a photo or a video otherwise. When
3702
- an inline message is edited, a new file
3703
- can't be uploaded; use a previously uploaded file
3704
- via its file_id or specify a URL. On
3705
- success, if the edited message is not an
3706
- inline message, the edited Message is returned, otherwise
3707
- True is returned. Note that business messages that
3708
- were not sent by the bot and do
3709
- not contain an inline keyboard can only be
3710
- edited within 48 hours from the time they
3711
- were sent.
3975
+ live photo, photo, or video messages, or to
3976
+ add media to text messages. If a message
3977
+ is part of a message album, then it
3978
+ can be edited only to an audio for
3979
+ audio albums, only to a document for document
3980
+ albums and to a photo, a live photo,
3981
+ or a video otherwise. When an inline message
3982
+ is edited, a new file can't be uploaded;
3983
+ use a previously uploaded file via its file_id
3984
+ or specify a URL. On success, if the
3985
+ edited message is not an inline message, the
3986
+ edited Message is returned, otherwise True is returned.
3987
+ Note that business messages that were not sent
3988
+ by the bot and do not contain an
3989
+ inline keyboard can only be edited within 48
3990
+ hours from the time they were sent.
3712
3991
 
3713
3992
  Reference: https://core.telegram.org/bots/api#editmessagemedia
3714
3993
  '''
@@ -3801,7 +4080,7 @@ class Methods(core.BaseBot):
3801
4080
  async def edit_message_checklist(
3802
4081
  self,
3803
4082
  business_connection_id: str,
3804
- chat_id: int,
4083
+ chat_id: Union[int, str],
3805
4084
  message_id: int,
3806
4085
  checklist: InputChecklist,
3807
4086
  reply_markup: Optional[InlineKeyboardMarkup] = None,
@@ -3977,6 +4256,53 @@ class Methods(core.BaseBot):
3977
4256
  })
3978
4257
  return BoolAdapter.validate_python(response)
3979
4258
 
4259
+ async def delete_message_reaction(
4260
+ self,
4261
+ chat_id: Union[int, str],
4262
+ message_id: int,
4263
+ user_id: Optional[int] = None,
4264
+ actor_chat_id: Optional[int] = None,
4265
+ ) -> bool:
4266
+ '''
4267
+ Use this method to remove a reaction from
4268
+ a message in a group or a supergroup
4269
+ chat. The bot must have the 'can_delete_messages' administrator
4270
+ right in the chat. Returns True on success.
4271
+
4272
+ Reference: https://core.telegram.org/bots/api#deletemessagereaction
4273
+ '''
4274
+
4275
+ response = await self._send_request('deleteMessageReaction', {
4276
+ 'chat_id': chat_id,
4277
+ 'message_id': message_id,
4278
+ 'user_id': user_id,
4279
+ 'actor_chat_id': actor_chat_id,
4280
+ })
4281
+ return BoolAdapter.validate_python(response)
4282
+
4283
+ async def delete_all_message_reactions(
4284
+ self,
4285
+ chat_id: Union[int, str],
4286
+ user_id: Optional[int] = None,
4287
+ actor_chat_id: Optional[int] = None,
4288
+ ) -> bool:
4289
+ '''
4290
+ Use this method to remove up to 10000
4291
+ recent reactions in a group or a supergroup
4292
+ chat added by a given user or chat.
4293
+ The bot must have the 'can_delete_messages' administrator right
4294
+ in the chat. Returns True on success.
4295
+
4296
+ Reference: https://core.telegram.org/bots/api#deleteallmessagereactions
4297
+ '''
4298
+
4299
+ response = await self._send_request('deleteAllMessageReactions', {
4300
+ 'chat_id': chat_id,
4301
+ 'user_id': user_id,
4302
+ 'actor_chat_id': actor_chat_id,
4303
+ })
4304
+ return BoolAdapter.validate_python(response)
4305
+
3980
4306
  async def send_sticker(
3981
4307
  self,
3982
4308
  chat_id: Union[int, str],
@@ -4352,54 +4678,6 @@ class Methods(core.BaseBot):
4352
4678
  })
4353
4679
  return BoolAdapter.validate_python(response)
4354
4680
 
4355
- async def answer_web_app_query(
4356
- self,
4357
- web_app_query_id: str,
4358
- result: _InlineQueryResult,
4359
- ) -> SentWebAppMessage:
4360
- '''
4361
- Use this method to set the result of
4362
- an interaction with a Web App and send
4363
- a corresponding message on behalf of the user
4364
- to the chat from which the query originated.
4365
- On success, a SentWebAppMessage object is returned.
4366
-
4367
- Reference: https://core.telegram.org/bots/api#answerwebappquery
4368
- '''
4369
-
4370
- response = await self._send_request('answerWebAppQuery', {
4371
- 'web_app_query_id': web_app_query_id,
4372
- 'result': result,
4373
- })
4374
- return SentWebAppMessage.model_validate(response)
4375
-
4376
- async def save_prepared_inline_message(
4377
- self,
4378
- user_id: int,
4379
- result: _InlineQueryResult,
4380
- allow_user_chats: Optional[bool] = None,
4381
- allow_bot_chats: Optional[bool] = None,
4382
- allow_group_chats: Optional[bool] = None,
4383
- allow_channel_chats: Optional[bool] = None,
4384
- ) -> PreparedInlineMessage:
4385
- '''
4386
- Stores a message that can be sent by
4387
- a user of a Mini App. Returns a
4388
- PreparedInlineMessage object.
4389
-
4390
- Reference: https://core.telegram.org/bots/api#savepreparedinlinemessage
4391
- '''
4392
-
4393
- response = await self._send_request('savePreparedInlineMessage', {
4394
- 'user_id': user_id,
4395
- 'result': result,
4396
- 'allow_user_chats': allow_user_chats,
4397
- 'allow_bot_chats': allow_bot_chats,
4398
- 'allow_group_chats': allow_group_chats,
4399
- 'allow_channel_chats': allow_channel_chats,
4400
- })
4401
- return PreparedInlineMessage.model_validate(response)
4402
-
4403
4681
  async def send_invoice(
4404
4682
  self,
4405
4683
  chat_id: Union[int, str],
@@ -4682,7 +4960,7 @@ class Methods(core.BaseBot):
4682
4960
 
4683
4961
  async def send_game(
4684
4962
  self,
4685
- chat_id: int,
4963
+ chat_id: Union[int, str],
4686
4964
  game_short_name: str,
4687
4965
  business_connection_id: Optional[str] = None,
4688
4966
  message_thread_id: Optional[int] = None,