telegrinder 0.1.dev160__py3-none-any.whl → 0.1.dev162__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.
- telegrinder/api/abc.py +3 -0
- telegrinder/api/api.py +7 -5
- telegrinder/api/error.py +3 -3
- telegrinder/bot/bot.py +2 -2
- telegrinder/bot/cute_types/base.py +1 -4
- telegrinder/bot/cute_types/message.py +140 -0
- telegrinder/bot/dispatch/composition.py +1 -1
- telegrinder/bot/dispatch/dispatch.py +1 -1
- telegrinder/bot/dispatch/waiter_machine/short_state.py +1 -1
- telegrinder/bot/scenario/__init__.py +2 -2
- telegrinder/bot/scenario/checkbox.py +10 -15
- telegrinder/bot/scenario/choice.py +2 -2
- telegrinder/modules.py +5 -3
- telegrinder/msgspec_json.py +3 -3
- telegrinder/msgspec_utils.py +34 -35
- telegrinder/tools/__init__.py +6 -0
- telegrinder/tools/buttons.py +8 -13
- telegrinder/tools/formatting/__init__.py +6 -0
- telegrinder/tools/formatting/html.py +10 -0
- telegrinder/tools/formatting/links.py +7 -0
- telegrinder/tools/formatting/spec_html_formats.py +27 -15
- telegrinder/tools/keyboard.py +3 -3
- telegrinder/tools/loop_wrapper/abc.py +4 -4
- telegrinder/types/enums.py +4 -0
- telegrinder/types/methods.py +175 -41
- telegrinder/types/objects.py +425 -201
- {telegrinder-0.1.dev160.dist-info → telegrinder-0.1.dev162.dist-info}/METADATA +1 -1
- {telegrinder-0.1.dev160.dist-info → telegrinder-0.1.dev162.dist-info}/RECORD +30 -30
- {telegrinder-0.1.dev160.dist-info → telegrinder-0.1.dev162.dist-info}/WHEEL +1 -1
- {telegrinder-0.1.dev160.dist-info → telegrinder-0.1.dev162.dist-info}/LICENSE +0 -0
telegrinder/types/methods.py
CHANGED
|
@@ -11,6 +11,8 @@ if typing.TYPE_CHECKING:
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class APIMethods:
|
|
14
|
+
"""Telegram Bot API 7.2 methods, released `March 31, 2024`."""
|
|
15
|
+
|
|
14
16
|
def __init__(self, api: "ABCAPI") -> None:
|
|
15
17
|
self.api = api
|
|
16
18
|
|
|
@@ -202,6 +204,7 @@ class APIMethods:
|
|
|
202
204
|
self,
|
|
203
205
|
chat_id: int | str,
|
|
204
206
|
text: str,
|
|
207
|
+
business_connection_id: str | None = None,
|
|
205
208
|
message_thread_id: int | None = None,
|
|
206
209
|
parse_mode: str | None = None,
|
|
207
210
|
entities: list[MessageEntity] | None = None,
|
|
@@ -222,6 +225,9 @@ class APIMethods:
|
|
|
222
225
|
|
|
223
226
|
Use this method to send text messages. On success, the sent Message is returned.
|
|
224
227
|
|
|
228
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
229
|
+
will be sent.
|
|
230
|
+
|
|
225
231
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
226
232
|
(in the format @channelusername).
|
|
227
233
|
|
|
@@ -245,8 +251,9 @@ class APIMethods:
|
|
|
245
251
|
:param reply_parameters: Description of the message to reply to.
|
|
246
252
|
|
|
247
253
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
248
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
249
|
-
or to force a reply from the user.
|
|
254
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
255
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
256
|
+
of a business account.
|
|
250
257
|
"""
|
|
251
258
|
|
|
252
259
|
method_response = await self.api.request_raw(
|
|
@@ -455,6 +462,7 @@ class APIMethods:
|
|
|
455
462
|
self,
|
|
456
463
|
chat_id: int | str,
|
|
457
464
|
photo: InputFile | str,
|
|
465
|
+
business_connection_id: str | None = None,
|
|
458
466
|
message_thread_id: int | None = None,
|
|
459
467
|
caption: str | None = None,
|
|
460
468
|
parse_mode: str | None = None,
|
|
@@ -476,6 +484,9 @@ class APIMethods:
|
|
|
476
484
|
|
|
477
485
|
Use this method to send photos. On success, the sent Message is returned.
|
|
478
486
|
|
|
487
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
488
|
+
will be sent.
|
|
489
|
+
|
|
479
490
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
480
491
|
(in the format @channelusername).
|
|
481
492
|
|
|
@@ -507,8 +518,9 @@ class APIMethods:
|
|
|
507
518
|
:param reply_parameters: Description of the message to reply to.
|
|
508
519
|
|
|
509
520
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
510
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
511
|
-
or to force a reply from the user.
|
|
521
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
522
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
523
|
+
of a business account.
|
|
512
524
|
"""
|
|
513
525
|
|
|
514
526
|
method_response = await self.api.request_raw(
|
|
@@ -521,6 +533,7 @@ class APIMethods:
|
|
|
521
533
|
self,
|
|
522
534
|
chat_id: int | str,
|
|
523
535
|
audio: InputFile | str,
|
|
536
|
+
business_connection_id: str | None = None,
|
|
524
537
|
message_thread_id: int | None = None,
|
|
525
538
|
caption: str | None = None,
|
|
526
539
|
parse_mode: str | None = None,
|
|
@@ -549,6 +562,9 @@ class APIMethods:
|
|
|
549
562
|
of up to 50 MB in size, this limit may be changed in the future. For sending
|
|
550
563
|
voice messages, use the sendVoice method instead.
|
|
551
564
|
|
|
565
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
566
|
+
will be sent.
|
|
567
|
+
|
|
552
568
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
553
569
|
(in the format @channelusername).
|
|
554
570
|
|
|
@@ -589,8 +605,9 @@ class APIMethods:
|
|
|
589
605
|
:param reply_parameters: Description of the message to reply to.
|
|
590
606
|
|
|
591
607
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
592
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
593
|
-
or to force a reply from the user.
|
|
608
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
609
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
610
|
+
of a business account.
|
|
594
611
|
"""
|
|
595
612
|
|
|
596
613
|
method_response = await self.api.request_raw(
|
|
@@ -603,6 +620,7 @@ class APIMethods:
|
|
|
603
620
|
self,
|
|
604
621
|
chat_id: int | str,
|
|
605
622
|
document: InputFile | str,
|
|
623
|
+
business_connection_id: str | None = None,
|
|
606
624
|
message_thread_id: int | None = None,
|
|
607
625
|
thumbnail: InputFile | str | None = None,
|
|
608
626
|
caption: str | None = None,
|
|
@@ -627,6 +645,9 @@ class APIMethods:
|
|
|
627
645
|
Bots can currently send files of any type of up to 50 MB in size, this limit
|
|
628
646
|
may be changed in the future.
|
|
629
647
|
|
|
648
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
649
|
+
will be sent.
|
|
650
|
+
|
|
630
651
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
631
652
|
(in the format @channelusername).
|
|
632
653
|
|
|
@@ -665,8 +686,9 @@ class APIMethods:
|
|
|
665
686
|
:param reply_parameters: Description of the message to reply to.
|
|
666
687
|
|
|
667
688
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
668
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
669
|
-
or to force a reply from the user.
|
|
689
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
690
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
691
|
+
of a business account.
|
|
670
692
|
"""
|
|
671
693
|
|
|
672
694
|
method_response = await self.api.request_raw(
|
|
@@ -679,6 +701,7 @@ class APIMethods:
|
|
|
679
701
|
self,
|
|
680
702
|
chat_id: int | str,
|
|
681
703
|
video: InputFile | str,
|
|
704
|
+
business_connection_id: str | None = None,
|
|
682
705
|
message_thread_id: int | None = None,
|
|
683
706
|
duration: int | None = None,
|
|
684
707
|
width: int | None = None,
|
|
@@ -708,6 +731,9 @@ class APIMethods:
|
|
|
708
731
|
returned. Bots can currently send video files of up to 50 MB in size, this
|
|
709
732
|
limit may be changed in the future.
|
|
710
733
|
|
|
734
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
735
|
+
will be sent.
|
|
736
|
+
|
|
711
737
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
712
738
|
(in the format @channelusername).
|
|
713
739
|
|
|
@@ -753,8 +779,9 @@ class APIMethods:
|
|
|
753
779
|
:param reply_parameters: Description of the message to reply to.
|
|
754
780
|
|
|
755
781
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
756
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
757
|
-
or to force a reply from the user.
|
|
782
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
783
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
784
|
+
of a business account.
|
|
758
785
|
"""
|
|
759
786
|
|
|
760
787
|
method_response = await self.api.request_raw(
|
|
@@ -767,6 +794,7 @@ class APIMethods:
|
|
|
767
794
|
self,
|
|
768
795
|
chat_id: int | str,
|
|
769
796
|
animation: InputFile | str,
|
|
797
|
+
business_connection_id: str | None = None,
|
|
770
798
|
message_thread_id: int | None = None,
|
|
771
799
|
duration: int | None = None,
|
|
772
800
|
width: int | None = None,
|
|
@@ -794,6 +822,9 @@ class APIMethods:
|
|
|
794
822
|
sound). On success, the sent Message is returned. Bots can currently send
|
|
795
823
|
animation files of up to 50 MB in size, this limit may be changed in the future.
|
|
796
824
|
|
|
825
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
826
|
+
will be sent.
|
|
827
|
+
|
|
797
828
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
798
829
|
(in the format @channelusername).
|
|
799
830
|
|
|
@@ -837,8 +868,9 @@ class APIMethods:
|
|
|
837
868
|
:param reply_parameters: Description of the message to reply to.
|
|
838
869
|
|
|
839
870
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
840
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
841
|
-
or to force a reply from the user.
|
|
871
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
872
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
873
|
+
of a business account.
|
|
842
874
|
"""
|
|
843
875
|
|
|
844
876
|
method_response = await self.api.request_raw(
|
|
@@ -851,6 +883,7 @@ class APIMethods:
|
|
|
851
883
|
self,
|
|
852
884
|
chat_id: int | str,
|
|
853
885
|
voice: InputFile | str,
|
|
886
|
+
business_connection_id: str | None = None,
|
|
854
887
|
message_thread_id: int | None = None,
|
|
855
888
|
caption: str | None = None,
|
|
856
889
|
parse_mode: str | None = None,
|
|
@@ -876,6 +909,9 @@ class APIMethods:
|
|
|
876
909
|
On success, the sent Message is returned. Bots can currently send voice
|
|
877
910
|
messages of up to 50 MB in size, this limit may be changed in the future.
|
|
878
911
|
|
|
912
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
913
|
+
will be sent.
|
|
914
|
+
|
|
879
915
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
880
916
|
(in the format @channelusername).
|
|
881
917
|
|
|
@@ -904,8 +940,9 @@ class APIMethods:
|
|
|
904
940
|
:param reply_parameters: Description of the message to reply to.
|
|
905
941
|
|
|
906
942
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
907
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
908
|
-
or to force a reply from the user.
|
|
943
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
944
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
945
|
+
of a business account.
|
|
909
946
|
"""
|
|
910
947
|
|
|
911
948
|
method_response = await self.api.request_raw(
|
|
@@ -918,6 +955,7 @@ class APIMethods:
|
|
|
918
955
|
self,
|
|
919
956
|
chat_id: int | str,
|
|
920
957
|
video_note: InputFile | str,
|
|
958
|
+
business_connection_id: str | None = None,
|
|
921
959
|
message_thread_id: int | None = None,
|
|
922
960
|
duration: int | None = None,
|
|
923
961
|
length: int | None = None,
|
|
@@ -940,6 +978,9 @@ class APIMethods:
|
|
|
940
978
|
to 1 minute long. Use this method to send video messages. On success, the
|
|
941
979
|
sent Message is returned.
|
|
942
980
|
|
|
981
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
982
|
+
will be sent.
|
|
983
|
+
|
|
943
984
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
944
985
|
(in the format @channelusername).
|
|
945
986
|
|
|
@@ -970,8 +1011,9 @@ class APIMethods:
|
|
|
970
1011
|
:param reply_parameters: Description of the message to reply to.
|
|
971
1012
|
|
|
972
1013
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
973
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
974
|
-
or to force a reply from the user.
|
|
1014
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1015
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1016
|
+
of a business account.
|
|
975
1017
|
"""
|
|
976
1018
|
|
|
977
1019
|
method_response = await self.api.request_raw(
|
|
@@ -986,6 +1028,7 @@ class APIMethods:
|
|
|
986
1028
|
media: list[
|
|
987
1029
|
InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo
|
|
988
1030
|
],
|
|
1031
|
+
business_connection_id: str | None = None,
|
|
989
1032
|
message_thread_id: int | None = None,
|
|
990
1033
|
disable_notification: bool | None = None,
|
|
991
1034
|
protect_content: bool | None = None,
|
|
@@ -998,6 +1041,9 @@ class APIMethods:
|
|
|
998
1041
|
an album. Documents and audio files can be only grouped in an album with messages
|
|
999
1042
|
of the same type. On success, an array of Messages that were sent is returned.
|
|
1000
1043
|
|
|
1044
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1045
|
+
will be sent.
|
|
1046
|
+
|
|
1001
1047
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1002
1048
|
(in the format @channelusername).
|
|
1003
1049
|
|
|
@@ -1025,6 +1071,7 @@ class APIMethods:
|
|
|
1025
1071
|
chat_id: int | str,
|
|
1026
1072
|
latitude: float,
|
|
1027
1073
|
longitude: float,
|
|
1074
|
+
business_connection_id: str | None = None,
|
|
1028
1075
|
message_thread_id: int | None = None,
|
|
1029
1076
|
horizontal_accuracy: float | None = None,
|
|
1030
1077
|
live_period: int | None = None,
|
|
@@ -1046,6 +1093,9 @@ class APIMethods:
|
|
|
1046
1093
|
|
|
1047
1094
|
Use this method to send point on the map. On success, the sent Message is returned.
|
|
1048
1095
|
|
|
1096
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1097
|
+
will be sent.
|
|
1098
|
+
|
|
1049
1099
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1050
1100
|
(in the format @channelusername).
|
|
1051
1101
|
|
|
@@ -1074,8 +1124,9 @@ class APIMethods:
|
|
|
1074
1124
|
:param reply_parameters: Description of the message to reply to.
|
|
1075
1125
|
|
|
1076
1126
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
1077
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
1078
|
-
or to force a reply from the user.
|
|
1127
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1128
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1129
|
+
of a business account.
|
|
1079
1130
|
"""
|
|
1080
1131
|
|
|
1081
1132
|
method_response = await self.api.request_raw(
|
|
@@ -1091,6 +1142,7 @@ class APIMethods:
|
|
|
1091
1142
|
longitude: float,
|
|
1092
1143
|
title: str,
|
|
1093
1144
|
address: str,
|
|
1145
|
+
business_connection_id: str | None = None,
|
|
1094
1146
|
message_thread_id: int | None = None,
|
|
1095
1147
|
foursquare_id: str | None = None,
|
|
1096
1148
|
foursquare_type: str | None = None,
|
|
@@ -1113,6 +1165,9 @@ class APIMethods:
|
|
|
1113
1165
|
Use this method to send information about a venue. On success, the sent Message
|
|
1114
1166
|
is returned.
|
|
1115
1167
|
|
|
1168
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1169
|
+
will be sent.
|
|
1170
|
+
|
|
1116
1171
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1117
1172
|
(in the format @channelusername).
|
|
1118
1173
|
|
|
@@ -1143,8 +1198,9 @@ class APIMethods:
|
|
|
1143
1198
|
:param reply_parameters: Description of the message to reply to.
|
|
1144
1199
|
|
|
1145
1200
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
1146
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
1147
|
-
or to force a reply from the user.
|
|
1201
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1202
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1203
|
+
of a business account.
|
|
1148
1204
|
"""
|
|
1149
1205
|
|
|
1150
1206
|
method_response = await self.api.request_raw(
|
|
@@ -1158,6 +1214,7 @@ class APIMethods:
|
|
|
1158
1214
|
chat_id: int | str,
|
|
1159
1215
|
phone_number: str,
|
|
1160
1216
|
first_name: str,
|
|
1217
|
+
business_connection_id: str | None = None,
|
|
1161
1218
|
message_thread_id: int | None = None,
|
|
1162
1219
|
last_name: str | None = None,
|
|
1163
1220
|
vcard: str | None = None,
|
|
@@ -1177,6 +1234,9 @@ class APIMethods:
|
|
|
1177
1234
|
|
|
1178
1235
|
Use this method to send phone contacts. On success, the sent Message is returned.
|
|
1179
1236
|
|
|
1237
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1238
|
+
will be sent.
|
|
1239
|
+
|
|
1180
1240
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1181
1241
|
(in the format @channelusername).
|
|
1182
1242
|
|
|
@@ -1198,8 +1258,9 @@ class APIMethods:
|
|
|
1198
1258
|
:param reply_parameters: Description of the message to reply to.
|
|
1199
1259
|
|
|
1200
1260
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
1201
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
1202
|
-
or to force a reply from the user.
|
|
1261
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1262
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1263
|
+
of a business account.
|
|
1203
1264
|
"""
|
|
1204
1265
|
|
|
1205
1266
|
method_response = await self.api.request_raw(
|
|
@@ -1213,6 +1274,7 @@ class APIMethods:
|
|
|
1213
1274
|
chat_id: int | str,
|
|
1214
1275
|
question: str,
|
|
1215
1276
|
options: list[str],
|
|
1277
|
+
business_connection_id: str | None = None,
|
|
1216
1278
|
message_thread_id: int | None = None,
|
|
1217
1279
|
is_anonymous: bool | None = None,
|
|
1218
1280
|
type: typing.Literal["quiz", "regular"] | None = None,
|
|
@@ -1240,6 +1302,9 @@ class APIMethods:
|
|
|
1240
1302
|
|
|
1241
1303
|
Use this method to send a native poll. On success, the sent Message is returned.
|
|
1242
1304
|
|
|
1305
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1306
|
+
will be sent.
|
|
1307
|
+
|
|
1243
1308
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1244
1309
|
(in the format @channelusername).
|
|
1245
1310
|
|
|
@@ -1288,8 +1353,9 @@ class APIMethods:
|
|
|
1288
1353
|
:param reply_parameters: Description of the message to reply to.
|
|
1289
1354
|
|
|
1290
1355
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
1291
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
1292
|
-
or to force a reply from the user.
|
|
1356
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1357
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1358
|
+
of a business account.
|
|
1293
1359
|
"""
|
|
1294
1360
|
|
|
1295
1361
|
method_response = await self.api.request_raw(
|
|
@@ -1301,6 +1367,7 @@ class APIMethods:
|
|
|
1301
1367
|
async def send_dice(
|
|
1302
1368
|
self,
|
|
1303
1369
|
chat_id: int | str,
|
|
1370
|
+
business_connection_id: str | None = None,
|
|
1304
1371
|
message_thread_id: int | None = None,
|
|
1305
1372
|
emoji: DiceEmoji | None = None,
|
|
1306
1373
|
disable_notification: bool | None = None,
|
|
@@ -1320,6 +1387,9 @@ class APIMethods:
|
|
|
1320
1387
|
Use this method to send an animated emoji that will display a random value.
|
|
1321
1388
|
On success, the sent Message is returned.
|
|
1322
1389
|
|
|
1390
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
1391
|
+
will be sent.
|
|
1392
|
+
|
|
1323
1393
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1324
1394
|
(in the format @channelusername).
|
|
1325
1395
|
|
|
@@ -1337,8 +1407,9 @@ class APIMethods:
|
|
|
1337
1407
|
:param reply_parameters: Description of the message to reply to.
|
|
1338
1408
|
|
|
1339
1409
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
1340
|
-
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
1341
|
-
or to force a reply from the user.
|
|
1410
|
+
keyboard, custom reply keyboard, instructions to remove a reply keyboard \
|
|
1411
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
1412
|
+
of a business account.
|
|
1342
1413
|
"""
|
|
1343
1414
|
|
|
1344
1415
|
method_response = await self.api.request_raw(
|
|
@@ -1351,6 +1422,7 @@ class APIMethods:
|
|
|
1351
1422
|
self,
|
|
1352
1423
|
chat_id: int | str,
|
|
1353
1424
|
action: ChatAction,
|
|
1425
|
+
business_connection_id: str | None = None,
|
|
1354
1426
|
message_thread_id: int | None = None,
|
|
1355
1427
|
**other: typing.Any,
|
|
1356
1428
|
) -> Result[bool, APIError]:
|
|
@@ -1362,6 +1434,9 @@ class APIMethods:
|
|
|
1362
1434
|
on success. We only recommend using this method when a response from the
|
|
1363
1435
|
bot will take a noticeable amount of time to arrive.
|
|
1364
1436
|
|
|
1437
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the action \
|
|
1438
|
+
will be sent.
|
|
1439
|
+
|
|
1365
1440
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
1366
1441
|
(in the format @channelusername).
|
|
1367
1442
|
|
|
@@ -2684,6 +2759,25 @@ class APIMethods:
|
|
|
2684
2759
|
)
|
|
2685
2760
|
return full_result(method_response, UserChatBoosts)
|
|
2686
2761
|
|
|
2762
|
+
async def get_business_connection(
|
|
2763
|
+
self,
|
|
2764
|
+
business_connection_id: str,
|
|
2765
|
+
**other: typing.Any,
|
|
2766
|
+
) -> Result[BusinessConnection, APIError]:
|
|
2767
|
+
"""Method `getBusinessConnection`, see the [documentation](https://core.telegram.org/bots/api#getbusinessconnection)
|
|
2768
|
+
|
|
2769
|
+
Use this method to get information about the connection of the bot with a
|
|
2770
|
+
business account. Returns a BusinessConnection object on success.
|
|
2771
|
+
|
|
2772
|
+
:param business_connection_id: Unique identifier of the business connection.
|
|
2773
|
+
"""
|
|
2774
|
+
|
|
2775
|
+
method_response = await self.api.request_raw(
|
|
2776
|
+
"getBusinessConnection",
|
|
2777
|
+
get_params(locals()),
|
|
2778
|
+
)
|
|
2779
|
+
return full_result(method_response, BusinessConnection)
|
|
2780
|
+
|
|
2687
2781
|
async def set_my_commands(
|
|
2688
2782
|
self,
|
|
2689
2783
|
commands: list[BotCommand],
|
|
@@ -3316,6 +3410,7 @@ class APIMethods:
|
|
|
3316
3410
|
self,
|
|
3317
3411
|
chat_id: int | str,
|
|
3318
3412
|
sticker: InputFile | str,
|
|
3413
|
+
business_connection_id: str | None = None,
|
|
3319
3414
|
message_thread_id: int | None = None,
|
|
3320
3415
|
emoji: str | None = None,
|
|
3321
3416
|
disable_notification: bool | None = None,
|
|
@@ -3335,6 +3430,9 @@ class APIMethods:
|
|
|
3335
3430
|
Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
|
|
3336
3431
|
On success, the sent Message is returned.
|
|
3337
3432
|
|
|
3433
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
3434
|
+
will be sent.
|
|
3435
|
+
|
|
3338
3436
|
:param chat_id: Unique identifier for the target chat or username of the target channel \
|
|
3339
3437
|
(in the format @channelusername).
|
|
3340
3438
|
|
|
@@ -3343,10 +3441,10 @@ class APIMethods:
|
|
|
3343
3441
|
|
|
3344
3442
|
:param sticker: Sticker to send. Pass a file_id as String to send a file that exists on the \
|
|
3345
3443
|
Telegram servers (recommended), pass an HTTP URL as a String for Telegram \
|
|
3346
|
-
to get a .WEBP sticker from the Internet, or upload a new .WEBP or .
|
|
3347
|
-
using multipart/form-data. More information on Sending Files:
|
|
3348
|
-
|
|
3349
|
-
sent via an HTTP URL.
|
|
3444
|
+
to get a .WEBP sticker from the Internet, or upload a new .WEBP, .TGS, or .WEBM \
|
|
3445
|
+
sticker using multipart/form-data. More information on Sending Files: \
|
|
3446
|
+
https://core.telegram.org/bots/api#sending-files. Video and animated \
|
|
3447
|
+
stickers can't be sent via an HTTP URL.
|
|
3350
3448
|
|
|
3351
3449
|
:param emoji: Emoji associated with the sticker; only for just uploaded stickers.
|
|
3352
3450
|
|
|
@@ -3358,7 +3456,8 @@ class APIMethods:
|
|
|
3358
3456
|
|
|
3359
3457
|
:param reply_markup: Additional interface options. A JSON-serialized object for an inline \
|
|
3360
3458
|
keyboard, custom reply keyboard, instructions to remove reply keyboard \
|
|
3361
|
-
or to force a reply from the user.
|
|
3459
|
+
or to force a reply from the user. Not supported for messages sent on behalf \
|
|
3460
|
+
of a business account.
|
|
3362
3461
|
"""
|
|
3363
3462
|
|
|
3364
3463
|
method_response = await self.api.request_raw(
|
|
@@ -3414,9 +3513,9 @@ class APIMethods:
|
|
|
3414
3513
|
) -> Result[File, APIError]:
|
|
3415
3514
|
"""Method `uploadStickerFile`, see the [documentation](https://core.telegram.org/bots/api#uploadstickerfile)
|
|
3416
3515
|
|
|
3417
|
-
Use this method to upload a file with a sticker for later use in the createNewStickerSet
|
|
3418
|
-
|
|
3419
|
-
the uploaded File on success.
|
|
3516
|
+
Use this method to upload a file with a sticker for later use in the createNewStickerSet,
|
|
3517
|
+
addStickerToSet, or replaceStickerInSet methods (the file can be used
|
|
3518
|
+
multiple times). Returns the uploaded File on success.
|
|
3420
3519
|
|
|
3421
3520
|
:param user_id: User identifier of sticker file owner.
|
|
3422
3521
|
|
|
@@ -3438,7 +3537,6 @@ class APIMethods:
|
|
|
3438
3537
|
name: str,
|
|
3439
3538
|
title: str,
|
|
3440
3539
|
stickers: list[InputSticker],
|
|
3441
|
-
sticker_format: typing.Literal["static", "animated", "video"],
|
|
3442
3540
|
sticker_type: typing.Literal["regular", "mask", "custom_emoji"] | None = None,
|
|
3443
3541
|
needs_repainting: bool | None = None,
|
|
3444
3542
|
**other: typing.Any,
|
|
@@ -3460,8 +3558,6 @@ class APIMethods:
|
|
|
3460
3558
|
:param stickers: A JSON-serialized list of 1-50 initial stickers to be added to the sticker \
|
|
3461
3559
|
set.
|
|
3462
3560
|
|
|
3463
|
-
:param sticker_format: Format of stickers in the set, must be one of `static`, `animated`, `video`. \
|
|
3464
|
-
|
|
3465
3561
|
:param sticker_type: Type of stickers in the set, pass `regular`, `mask`, or `custom_emoji`. \
|
|
3466
3562
|
By default, a regular sticker set is created.
|
|
3467
3563
|
|
|
@@ -3486,10 +3582,8 @@ class APIMethods:
|
|
|
3486
3582
|
) -> Result[bool, APIError]:
|
|
3487
3583
|
"""Method `addStickerToSet`, see the [documentation](https://core.telegram.org/bots/api#addstickertoset)
|
|
3488
3584
|
|
|
3489
|
-
Use this method to add a new sticker to a set created by the bot.
|
|
3490
|
-
|
|
3491
|
-
Emoji sticker sets can have up to 200 stickers. Animated and video sticker
|
|
3492
|
-
sets can have up to 50 stickers. Static sticker sets can have up to 120 stickers.
|
|
3585
|
+
Use this method to add a new sticker to a set created by the bot. Emoji sticker
|
|
3586
|
+
sets can have up to 200 stickers. Other sticker sets can have up to 120 stickers.
|
|
3493
3587
|
Returns True on success.
|
|
3494
3588
|
|
|
3495
3589
|
:param user_id: User identifier of sticker set owner.
|
|
@@ -3548,6 +3642,37 @@ class APIMethods:
|
|
|
3548
3642
|
)
|
|
3549
3643
|
return full_result(method_response, bool)
|
|
3550
3644
|
|
|
3645
|
+
async def replace_sticker_in_set(
|
|
3646
|
+
self,
|
|
3647
|
+
user_id: int,
|
|
3648
|
+
name: str,
|
|
3649
|
+
old_sticker: str,
|
|
3650
|
+
sticker: InputSticker,
|
|
3651
|
+
**other: typing.Any,
|
|
3652
|
+
) -> Result[bool, APIError]:
|
|
3653
|
+
"""Method `replaceStickerInSet`, see the [documentation](https://core.telegram.org/bots/api#replacestickerinset)
|
|
3654
|
+
|
|
3655
|
+
Use this method to replace an existing sticker in a sticker set with a new
|
|
3656
|
+
one. The method is equivalent to calling deleteStickerFromSet, then addStickerToSet,
|
|
3657
|
+
then setStickerPositionInSet. Returns True on success.
|
|
3658
|
+
|
|
3659
|
+
:param user_id: User identifier of the sticker set owner.
|
|
3660
|
+
|
|
3661
|
+
:param name: Sticker set name.
|
|
3662
|
+
|
|
3663
|
+
:param old_sticker: File identifier of the replaced sticker.
|
|
3664
|
+
|
|
3665
|
+
:param sticker: A JSON-serialized object with information about the added sticker. If \
|
|
3666
|
+
exactly the same sticker had already been added to the set, then the set remains \
|
|
3667
|
+
unchanged.
|
|
3668
|
+
"""
|
|
3669
|
+
|
|
3670
|
+
method_response = await self.api.request_raw(
|
|
3671
|
+
"replaceStickerInSet",
|
|
3672
|
+
get_params(locals()),
|
|
3673
|
+
)
|
|
3674
|
+
return full_result(method_response, bool)
|
|
3675
|
+
|
|
3551
3676
|
async def set_sticker_emoji_list(
|
|
3552
3677
|
self,
|
|
3553
3678
|
sticker: str,
|
|
@@ -3644,6 +3769,7 @@ class APIMethods:
|
|
|
3644
3769
|
self,
|
|
3645
3770
|
name: str,
|
|
3646
3771
|
user_id: int,
|
|
3772
|
+
format: str,
|
|
3647
3773
|
thumbnail: InputFile | str | None = None,
|
|
3648
3774
|
**other: typing.Any,
|
|
3649
3775
|
) -> Result[bool, APIError]:
|
|
@@ -3669,6 +3795,9 @@ class APIMethods:
|
|
|
3669
3795
|
Animated and video sticker set thumbnails can't be uploaded via HTTP URL. \
|
|
3670
3796
|
If omitted, then the thumbnail is dropped and the first sticker is used as \
|
|
3671
3797
|
the thumbnail.
|
|
3798
|
+
|
|
3799
|
+
:param format: Format of the thumbnail, must be one of `static` for a .WEBP or .PNG image, \
|
|
3800
|
+
`animated` for a .TGS animation, or `video` for a WEBM video.
|
|
3672
3801
|
"""
|
|
3673
3802
|
|
|
3674
3803
|
method_response = await self.api.request_raw(
|
|
@@ -4086,6 +4215,7 @@ class APIMethods:
|
|
|
4086
4215
|
self,
|
|
4087
4216
|
chat_id: int,
|
|
4088
4217
|
game_short_name: str,
|
|
4218
|
+
business_connection_id: str | None = None,
|
|
4089
4219
|
message_thread_id: int | None = None,
|
|
4090
4220
|
disable_notification: bool | None = None,
|
|
4091
4221
|
protect_content: bool | None = None,
|
|
@@ -4097,6 +4227,9 @@ class APIMethods:
|
|
|
4097
4227
|
|
|
4098
4228
|
Use this method to send a game. On success, the sent Message is returned.
|
|
4099
4229
|
|
|
4230
|
+
:param business_connection_id: Unique identifier of the business connection on behalf of which the message \
|
|
4231
|
+
will be sent.
|
|
4232
|
+
|
|
4100
4233
|
:param chat_id: Unique identifier for the target chat.
|
|
4101
4234
|
|
|
4102
4235
|
:param message_thread_id: Unique identifier for the target message thread (topic) of the forum; for \
|
|
@@ -4113,6 +4246,7 @@ class APIMethods:
|
|
|
4113
4246
|
|
|
4114
4247
|
:param reply_markup: A JSON-serialized object for an inline keyboard. If empty, one 'Play game_title' \
|
|
4115
4248
|
button will be shown. If not empty, the first button must launch the game. \
|
|
4249
|
+
Not supported for messages sent on behalf of a business account.
|
|
4116
4250
|
"""
|
|
4117
4251
|
|
|
4118
4252
|
method_response = await self.api.request_raw(
|