pyTelegramBotAPI 4.29.1__py3-none-any.whl → 4.30.0__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.
- {pytelegrambotapi-4.29.1.dist-info → pytelegrambotapi-4.30.0.dist-info}/METADATA +3 -3
- {pytelegrambotapi-4.29.1.dist-info → pytelegrambotapi-4.30.0.dist-info}/RECORD +11 -11
- {pytelegrambotapi-4.29.1.dist-info → pytelegrambotapi-4.30.0.dist-info}/WHEEL +1 -1
- telebot/__init__.py +253 -8
- telebot/apihelper.py +119 -23
- telebot/async_telebot.py +254 -11
- telebot/asyncio_helper.py +112 -23
- telebot/types.py +260 -35
- telebot/util.py +1 -1
- telebot/version.py +1 -1
- {pytelegrambotapi-4.29.1.dist-info → pytelegrambotapi-4.30.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyTelegramBotAPI
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.30.0
|
|
4
4
|
Summary: Python Telegram bot API.
|
|
5
5
|
Project-URL: Homepage, https://github.com/eternnoir/pyTelegramBotAPI
|
|
6
6
|
Project-URL: Documentation, https://pytba.readthedocs.org
|
|
@@ -14,11 +14,11 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
14
14
|
Classifier: Environment :: Console
|
|
15
15
|
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
|
|
16
16
|
Classifier: Programming Language :: Python :: 3
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
22
|
Requires-Python: >=3.9
|
|
23
23
|
Requires-Dist: requests
|
|
24
24
|
Provides-Extra: coloredlogs
|
|
@@ -613,7 +613,7 @@ Refer [Bot Api](https://core.telegram.org/bots/api#messageentity) for extra deta
|
|
|
613
613
|
|
|
614
614
|
## Advanced use of the API
|
|
615
615
|
|
|
616
|
-
### Using local Bot API
|
|
616
|
+
### Using local Bot API Server
|
|
617
617
|
Since version 5.0 of the Bot API, you have the possibility to run your own [Local Bot API Server](https://core.telegram.org/bots/api#using-a-local-bot-api-server).
|
|
618
618
|
pyTelegramBotAPI also supports this feature.
|
|
619
619
|
```python
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
telebot/__init__.py,sha256=
|
|
2
|
-
telebot/apihelper.py,sha256=
|
|
3
|
-
telebot/async_telebot.py,sha256=
|
|
1
|
+
telebot/__init__.py,sha256=HgaCnO9mNyDl1zuLcNIMTrJAfNI9qi46ctl5pXRTKNI,496307
|
|
2
|
+
telebot/apihelper.py,sha256=jtBC48HW20caMh19BIVsm9nTSOn8l89kGbev46tlW94,122946
|
|
3
|
+
telebot/async_telebot.py,sha256=iCWPXNyHW3SvzI8kYme6wyBqFuBra0oNOPoDpw-nUSI,469862
|
|
4
4
|
telebot/asyncio_filters.py,sha256=UM5AznjF5Ffym20_linOvqn5mHy5KfXy9MdKjFbKtcQ,12857
|
|
5
5
|
telebot/asyncio_handler_backends.py,sha256=BWS7zr93FJNZJmPHBoXo4i_PIHGlmrEoWy1miXax9aI,2785
|
|
6
|
-
telebot/asyncio_helper.py,sha256=
|
|
6
|
+
telebot/asyncio_helper.py,sha256=T5JW6GjQh4ou2XXakZbKha58ng5Hl8GzZCxCOr9E-Fg,124146
|
|
7
7
|
telebot/callback_data.py,sha256=k4Rz3lAONG5J2M9TESKMIjqXoBNJMfEy9nnrmJAyi3Q,5358
|
|
8
8
|
telebot/custom_filters.py,sha256=ncF8_zwlSqkuATI46Xc6HQ5Y1ZoQ1fO6AlcRbs7bO3U,12975
|
|
9
9
|
telebot/formatting.py,sha256=at8WpXpmJLSat9XSgnpzFOIA6gKrHVBcvB8lJIlATjE,15509
|
|
10
10
|
telebot/handler_backends.py,sha256=lyKu0PaH2c4y5FfyQS3M9tOyBJ8ATjxHZkATzu01XpE,7969
|
|
11
11
|
telebot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
telebot/service_utils.py,sha256=xLmlZLTVs34UOdQtMvwduor8hnLxQCx8iJ92wDGl2Mw,2053
|
|
13
|
-
telebot/types.py,sha256=
|
|
14
|
-
telebot/util.py,sha256=
|
|
15
|
-
telebot/version.py,sha256=
|
|
13
|
+
telebot/types.py,sha256=V_X9UA1QL6UZhyIdu-t9HJkQOzMq6xFoJ23uIPKuDJo,574303
|
|
14
|
+
telebot/util.py,sha256=2Z-6H3r5NAkgwMB21laTY1-N7NYtbXZFKixC8Bis-kI,21759
|
|
15
|
+
telebot/version.py,sha256=pw0Qn9eSLPBj-ZIhFjTKjLcUH0a-ekCUV24bVMNDdrk,99
|
|
16
16
|
telebot/asyncio_storage/__init__.py,sha256=fraOWJby1ddJmPAXf1oXWmZJXRodSpING17MF875NPI,433
|
|
17
17
|
telebot/asyncio_storage/base_storage.py,sha256=JVoT2Xk3EfyWFauE6ToeHP2E3kwt81KRkACay6wQynE,3819
|
|
18
18
|
telebot/asyncio_storage/memory_storage.py,sha256=h8yc2xpfLmbcBjPmKkqNhZtUtpNQ7EuKIfMGue61e7w,5849
|
|
@@ -36,7 +36,7 @@ telebot/storage/base_storage.py,sha256=AJ7X3ZTMzVeQsgfQV8bRHxvRj7QUvOcTrGI1fWiuM
|
|
|
36
36
|
telebot/storage/memory_storage.py,sha256=-r1vuIt1YHq9btkr6E7BCu4Do-wUDlNcttG22SSgEYo,5799
|
|
37
37
|
telebot/storage/pickle_storage.py,sha256=wjFuRxSBeCMB3h-fUqLgqe2XcZoc6-ixkN5qsm3th9I,7136
|
|
38
38
|
telebot/storage/redis_storage.py,sha256=DReU2lc8cI0f3XMIT1N9-suGZ6jE8H9I_mapK3A-lyE,9450
|
|
39
|
-
pytelegrambotapi-4.
|
|
40
|
-
pytelegrambotapi-4.
|
|
41
|
-
pytelegrambotapi-4.
|
|
42
|
-
pytelegrambotapi-4.
|
|
39
|
+
pytelegrambotapi-4.30.0.dist-info/METADATA,sha256=8mc2r5FHuRrwlyIDPKqOvdQQaJLymVakFJZsOMZ4M9Q,48281
|
|
40
|
+
pytelegrambotapi-4.30.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
41
|
+
pytelegrambotapi-4.30.0.dist-info/licenses/LICENSE,sha256=qz_jTTxi4zSAFaTdASiwml2iAk0UZ6R4MRADNzwYo_A,18387
|
|
42
|
+
pytelegrambotapi-4.30.0.dist-info/RECORD,,
|
telebot/__init__.py
CHANGED
|
@@ -1827,7 +1827,8 @@ class TeleBot:
|
|
|
1827
1827
|
message_thread_id: Optional[int]=None,
|
|
1828
1828
|
video_start_timestamp: Optional[int]=None,
|
|
1829
1829
|
direct_messages_topic_id: Optional[int]=None,
|
|
1830
|
-
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None
|
|
1830
|
+
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None,
|
|
1831
|
+
message_effect_id: Optional[str]=None) -> types.Message:
|
|
1831
1832
|
"""
|
|
1832
1833
|
Use this method to forward messages of any kind.
|
|
1833
1834
|
|
|
@@ -1866,6 +1867,9 @@ class TeleBot:
|
|
|
1866
1867
|
is automatically declined.
|
|
1867
1868
|
:type suggested_post_parameters: :class:`telebot.types.SuggestedPostParameters`
|
|
1868
1869
|
|
|
1870
|
+
:param message_effect_id: Unique identifier of the message effect to be added to the message; only available when forwarding to private chats
|
|
1871
|
+
:type message_effect_id: :obj:`str`
|
|
1872
|
+
|
|
1869
1873
|
:return: On success, the sent Message is returned.
|
|
1870
1874
|
:rtype: :class:`telebot.types.Message`
|
|
1871
1875
|
"""
|
|
@@ -1877,7 +1881,7 @@ class TeleBot:
|
|
|
1877
1881
|
self.token, chat_id, from_chat_id, message_id, disable_notification=disable_notification,
|
|
1878
1882
|
timeout=timeout, protect_content=protect_content, message_thread_id=message_thread_id,
|
|
1879
1883
|
video_start_timestamp=video_start_timestamp, direct_messages_topic_id=direct_messages_topic_id,
|
|
1880
|
-
suggested_post_parameters=suggested_post_parameters
|
|
1884
|
+
suggested_post_parameters=suggested_post_parameters, message_effect_id=message_effect_id
|
|
1881
1885
|
)
|
|
1882
1886
|
)
|
|
1883
1887
|
|
|
@@ -1901,7 +1905,8 @@ class TeleBot:
|
|
|
1901
1905
|
allow_paid_broadcast: Optional[bool]=None,
|
|
1902
1906
|
video_start_timestamp: Optional[int]=None,
|
|
1903
1907
|
direct_messages_topic_id: Optional[int]=None,
|
|
1904
|
-
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None
|
|
1908
|
+
suggested_post_parameters: Optional[types.SuggestedPostParameters]=None,
|
|
1909
|
+
message_effect_id: Optional[str]=None) -> types.MessageID:
|
|
1905
1910
|
"""
|
|
1906
1911
|
Use this method to copy messages of any kind.
|
|
1907
1912
|
Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
|
|
@@ -1973,6 +1978,9 @@ class TeleBot:
|
|
|
1973
1978
|
is automatically declined.
|
|
1974
1979
|
:type suggested_post_parameters: :class:`telebot.types.SuggestedPostParameters`
|
|
1975
1980
|
|
|
1981
|
+
:param message_effect_id: Unique identifier of the message effect to be added to the message; only available when copying to private chats
|
|
1982
|
+
:type message_effect_id: :obj:`str`
|
|
1983
|
+
|
|
1976
1984
|
:return: On success, the MessageId of the sent message is returned.
|
|
1977
1985
|
:rtype: :class:`telebot.types.MessageID`
|
|
1978
1986
|
"""
|
|
@@ -2006,7 +2014,7 @@ class TeleBot:
|
|
|
2006
2014
|
message_thread_id=message_thread_id, reply_parameters=reply_parameters,
|
|
2007
2015
|
show_caption_above_media=show_caption_above_media, allow_paid_broadcast=allow_paid_broadcast,
|
|
2008
2016
|
video_start_timestamp=video_start_timestamp, direct_messages_topic_id=direct_messages_topic_id,
|
|
2009
|
-
suggested_post_parameters=suggested_post_parameters
|
|
2017
|
+
suggested_post_parameters=suggested_post_parameters, message_effect_id=message_effect_id
|
|
2010
2018
|
))
|
|
2011
2019
|
|
|
2012
2020
|
|
|
@@ -4195,6 +4203,45 @@ class TeleBot:
|
|
|
4195
4203
|
business_connection_id=business_connection_id, message_effect_id=message_effect_id, allow_paid_broadcast=allow_paid_broadcast,
|
|
4196
4204
|
direct_messages_topic_id=direct_messages_topic_id, suggested_post_parameters=suggested_post_parameters)
|
|
4197
4205
|
)
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
def send_message_draft(
|
|
4209
|
+
self, chat_id: int,
|
|
4210
|
+
draft_id: int,
|
|
4211
|
+
text: str,
|
|
4212
|
+
message_thread_id: Optional[int]=None,
|
|
4213
|
+
parse_mode: Optional[str]=None,
|
|
4214
|
+
entities: Optional[List[types.MessageEntity]]=None):
|
|
4215
|
+
"""
|
|
4216
|
+
Use this method to stream a partial message to a user while the message is being generated;
|
|
4217
|
+
supported only for bots with forum topic mode enabled. Returns True on success.
|
|
4218
|
+
|
|
4219
|
+
Telegram documentation: https://core.telegram.org/bots/api#sendmessagedraft
|
|
4220
|
+
|
|
4221
|
+
:param chat_id: Unique identifier for the target private chat
|
|
4222
|
+
:type chat_id: :obj:`int`
|
|
4223
|
+
|
|
4224
|
+
:param message_thread_id: Unique identifier for the target message thread
|
|
4225
|
+
:type message_thread_id: :obj:`int`
|
|
4226
|
+
|
|
4227
|
+
:param draft_id: Unique identifier of the message draft; must be non-zero. Changes of drafts with the same identifier are animated
|
|
4228
|
+
:type draft_id: :obj:`int`
|
|
4229
|
+
|
|
4230
|
+
:param text: Text of the message to be sent, 1-4096 characters after entities parsing
|
|
4231
|
+
:type text: :obj:`str`
|
|
4232
|
+
|
|
4233
|
+
:param parse_mode: Mode for parsing entities in the message text. See formatting options for more details.
|
|
4234
|
+
:type parse_mode: :obj:`str`
|
|
4235
|
+
|
|
4236
|
+
:param entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
|
|
4237
|
+
:type entities: :obj:`list` of :class:`telebot.types.MessageEntity
|
|
4238
|
+
|
|
4239
|
+
:return: Returns True on success.
|
|
4240
|
+
:rtype: :obj:`bool`
|
|
4241
|
+
"""
|
|
4242
|
+
return apihelper.send_message_draft(
|
|
4243
|
+
self.token, chat_id, draft_id, text, parse_mode=parse_mode, entities=entities, message_thread_id=message_thread_id)
|
|
4244
|
+
|
|
4198
4245
|
|
|
4199
4246
|
|
|
4200
4247
|
def send_chat_action(
|
|
@@ -4222,7 +4269,7 @@ class TeleBot:
|
|
|
4222
4269
|
:param timeout: Timeout in seconds for the request.
|
|
4223
4270
|
:type timeout: :obj:`int`
|
|
4224
4271
|
|
|
4225
|
-
:param message_thread_id: The thread identifier of a message from which the reply will be sent(supergroups
|
|
4272
|
+
:param message_thread_id: The thread identifier of a message from which the reply will be sent(for supergroups and private chats)
|
|
4226
4273
|
:type message_thread_id: :obj:`int`
|
|
4227
4274
|
|
|
4228
4275
|
:param business_connection_id: Identifier of a business connection
|
|
@@ -6909,7 +6956,10 @@ class TeleBot:
|
|
|
6909
6956
|
exclude_unique: Optional[bool]=None,
|
|
6910
6957
|
sort_by_price: Optional[bool]=None,
|
|
6911
6958
|
offset: Optional[str]=None,
|
|
6912
|
-
limit: Optional[int]=None
|
|
6959
|
+
limit: Optional[int]=None,
|
|
6960
|
+
exclude_limited_upgradable: Optional[bool]=None,
|
|
6961
|
+
exclude_limited_non_upgradable: Optional[bool]=None,
|
|
6962
|
+
exclude_from_blockchain: Optional[bool]=None,) -> types.OwnedGifts:
|
|
6913
6963
|
"""
|
|
6914
6964
|
Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.
|
|
6915
6965
|
|
|
@@ -6927,12 +6977,15 @@ class TeleBot:
|
|
|
6927
6977
|
:param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
|
|
6928
6978
|
:type exclude_unlimited: :obj:`bool`
|
|
6929
6979
|
|
|
6930
|
-
:param exclude_limited:
|
|
6980
|
+
:param exclude_limited: Deprecated, use exclude_limited_upgradable and exclude_limited_non_upgradable instead.
|
|
6931
6981
|
:type exclude_limited: :obj:`bool`
|
|
6932
6982
|
|
|
6933
6983
|
:param exclude_unique: Pass True to exclude unique gifts
|
|
6934
6984
|
:type exclude_unique: :obj:`bool`
|
|
6935
6985
|
|
|
6986
|
+
:param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
|
|
6987
|
+
:type exclude_from_blockchain: :obj:`bool`
|
|
6988
|
+
|
|
6936
6989
|
:param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
|
|
6937
6990
|
:type sort_by_price: :obj:`bool`
|
|
6938
6991
|
|
|
@@ -6942,16 +6995,163 @@ class TeleBot:
|
|
|
6942
6995
|
:param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
|
|
6943
6996
|
:type limit: :obj:`int`
|
|
6944
6997
|
|
|
6998
|
+
:param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
|
|
6999
|
+
:type exclude_limited_upgradable: :obj:`bool`
|
|
7000
|
+
|
|
7001
|
+
:param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
|
|
7002
|
+
:type exclude_limited_non_upgradable: :obj:`bool`
|
|
7003
|
+
|
|
6945
7004
|
:return: On success, a OwnedGifts object is returned.
|
|
6946
7005
|
:rtype: :class:`telebot.types.OwnedGifts`
|
|
6947
7006
|
"""
|
|
7007
|
+
|
|
7008
|
+
if exclude_limited is not None:
|
|
7009
|
+
logger.warning("Deprecation warning. 'exclude_limited' parameter is deprecated in get_business_account_gifts. Use 'exclude_limited_upgradable' and 'exclude_limited_non_upgradable' instead.")
|
|
7010
|
+
|
|
7011
|
+
if exclude_limited_upgradable is not None or exclude_limited_non_upgradable is not None:
|
|
7012
|
+
logger.warning("Both 'exclude_limited' and 'exclude_limited_upgradable'/'exclude_limited_non_upgradable' parameters are set: conflicting, using 'exclude_limited_upgradable' and 'exclude_limited_non_upgradable' values.")
|
|
7013
|
+
|
|
7014
|
+
else:
|
|
7015
|
+
exclude_limited_upgradable = exclude_limited
|
|
7016
|
+
exclude_limited_non_upgradable = exclude_limited
|
|
7017
|
+
|
|
6948
7018
|
return types.OwnedGifts.de_json(
|
|
6949
7019
|
apihelper.get_business_account_gifts(
|
|
6950
7020
|
self.token, business_connection_id,
|
|
6951
7021
|
exclude_unsaved=exclude_unsaved,
|
|
6952
7022
|
exclude_saved=exclude_saved,
|
|
6953
7023
|
exclude_unlimited=exclude_unlimited,
|
|
6954
|
-
|
|
7024
|
+
exclude_unique=exclude_unique,
|
|
7025
|
+
sort_by_price=sort_by_price,
|
|
7026
|
+
offset=offset,
|
|
7027
|
+
limit=limit,
|
|
7028
|
+
exclude_limited_upgradable=exclude_limited_upgradable,
|
|
7029
|
+
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
|
7030
|
+
exclude_from_blockchain=exclude_from_blockchain
|
|
7031
|
+
)
|
|
7032
|
+
)
|
|
7033
|
+
|
|
7034
|
+
def get_user_gifts(
|
|
7035
|
+
self, user_id: int,
|
|
7036
|
+
exclude_unlimited: Optional[bool]=None,
|
|
7037
|
+
exclude_limited_upgradable: Optional[bool]=None,
|
|
7038
|
+
exclude_limited_non_upgradable: Optional[bool]=None,
|
|
7039
|
+
exclude_from_blockchain: Optional[bool]=None,
|
|
7040
|
+
exclude_unique: Optional[bool]=None,
|
|
7041
|
+
sort_by_price: Optional[bool]=None,
|
|
7042
|
+
offset: Optional[str]=None,
|
|
7043
|
+
limit: Optional[int]=None) -> types.OwnedGifts:
|
|
7044
|
+
"""
|
|
7045
|
+
Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.
|
|
7046
|
+
|
|
7047
|
+
Telegram documentation: https://core.telegram.org/bots/api#getusergifts
|
|
7048
|
+
|
|
7049
|
+
:param user_id: Unique identifier of the user
|
|
7050
|
+
:type user_id: :obj:`int`
|
|
7051
|
+
|
|
7052
|
+
:param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
|
|
7053
|
+
:type exclude_unlimited: :obj:`bool`
|
|
7054
|
+
|
|
7055
|
+
:param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
|
|
7056
|
+
:type exclude_limited_upgradable: :obj:`bool`
|
|
7057
|
+
|
|
7058
|
+
:param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
|
|
7059
|
+
:type exclude_limited_non_upgradable: :obj:`bool`
|
|
7060
|
+
|
|
7061
|
+
:param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
|
|
7062
|
+
:type exclude_from_blockchain: :obj:`bool`
|
|
7063
|
+
|
|
7064
|
+
:param exclude_unique: Pass True to exclude unique gifts
|
|
7065
|
+
:type exclude_unique: :obj:`bool`
|
|
7066
|
+
|
|
7067
|
+
:param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
|
|
7068
|
+
:type sort_by_price: :obj:`bool`
|
|
7069
|
+
|
|
7070
|
+
:param offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
|
|
7071
|
+
:type offset: :obj:`str`
|
|
7072
|
+
|
|
7073
|
+
:param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
|
|
7074
|
+
:type limit: :obj:`int`
|
|
7075
|
+
|
|
7076
|
+
:return: On success, a OwnedGifts object is returned.
|
|
7077
|
+
:rtype: :class:`telebot.types.OwnedGifts`
|
|
7078
|
+
"""
|
|
7079
|
+
return types.OwnedGifts.de_json(
|
|
7080
|
+
apihelper.get_user_gifts(
|
|
7081
|
+
self.token, user_id,
|
|
7082
|
+
exclude_unlimited=exclude_unlimited,
|
|
7083
|
+
exclude_limited_upgradable=exclude_limited_upgradable,
|
|
7084
|
+
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
|
7085
|
+
exclude_from_blockchain=exclude_from_blockchain,
|
|
7086
|
+
exclude_unique=exclude_unique,
|
|
7087
|
+
sort_by_price=sort_by_price,
|
|
7088
|
+
offset=offset,
|
|
7089
|
+
limit=limit
|
|
7090
|
+
)
|
|
7091
|
+
)
|
|
7092
|
+
|
|
7093
|
+
def get_chat_gifts(
|
|
7094
|
+
self, chat_id: Union[int, str],
|
|
7095
|
+
exclude_unsaved: Optional[bool]=None,
|
|
7096
|
+
exclude_saved: Optional[bool]=None,
|
|
7097
|
+
exclude_unlimited: Optional[bool]=None,
|
|
7098
|
+
exclude_limited_upgradable: Optional[bool]=None,
|
|
7099
|
+
exclude_limited_non_upgradable: Optional[bool]=None,
|
|
7100
|
+
exclude_from_blockchain: Optional[bool]=None,
|
|
7101
|
+
exclude_unique: Optional[bool]=None,
|
|
7102
|
+
sort_by_price: Optional[bool]=None,
|
|
7103
|
+
offset: Optional[str]=None,
|
|
7104
|
+
limit: Optional[int]=None) -> types.OwnedGifts:
|
|
7105
|
+
"""
|
|
7106
|
+
Returns the gifts owned by a chat. Returns OwnedGifts on success.
|
|
7107
|
+
|
|
7108
|
+
Telegram documentation: https://core.telegram.org/bots/api#getchatgifts
|
|
7109
|
+
|
|
7110
|
+
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
|
|
7111
|
+
:type chat_id: :obj:`int` | :obj:`str`
|
|
7112
|
+
|
|
7113
|
+
:param exclude_unsaved: Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel.
|
|
7114
|
+
:type exclude_unsaved: :obj:`bool`
|
|
7115
|
+
|
|
7116
|
+
:param exclude_saved: Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel.
|
|
7117
|
+
:type exclude_saved: :obj:`bool`
|
|
7118
|
+
|
|
7119
|
+
:param exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
|
|
7120
|
+
:type exclude_unlimited: :obj:`bool`
|
|
7121
|
+
|
|
7122
|
+
:param exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
|
|
7123
|
+
:type exclude_limited_upgradable: :obj:`bool`
|
|
7124
|
+
|
|
7125
|
+
:param exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
|
|
7126
|
+
:type exclude_limited_non_upgradable: :obj:`bool`
|
|
7127
|
+
|
|
7128
|
+
:param exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
|
|
7129
|
+
:type exclude_from_blockchain: :obj:`bool`
|
|
7130
|
+
|
|
7131
|
+
:param exclude_unique: Pass True to exclude unique gifts
|
|
7132
|
+
:type exclude_unique: :obj:`bool`
|
|
7133
|
+
|
|
7134
|
+
:param sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
|
|
7135
|
+
:type sort_by_price: :obj:`bool`
|
|
7136
|
+
|
|
7137
|
+
:param offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
|
|
7138
|
+
:type offset: :obj:`str`
|
|
7139
|
+
|
|
7140
|
+
:param limit: The maximum number of gifts to be returned; 1-100. Defaults to 100
|
|
7141
|
+
:type limit: :obj:`int`
|
|
7142
|
+
|
|
7143
|
+
:return: On success, a OwnedGifts object is returned.
|
|
7144
|
+
:rtype: :class:`telebot.types.OwnedGifts`
|
|
7145
|
+
"""
|
|
7146
|
+
return types.OwnedGifts.de_json(
|
|
7147
|
+
apihelper.get_chat_gifts(
|
|
7148
|
+
self.token, chat_id,
|
|
7149
|
+
exclude_unsaved=exclude_unsaved,
|
|
7150
|
+
exclude_saved=exclude_saved,
|
|
7151
|
+
exclude_unlimited=exclude_unlimited,
|
|
7152
|
+
exclude_limited_upgradable=exclude_limited_upgradable,
|
|
7153
|
+
exclude_limited_non_upgradable=exclude_limited_non_upgradable,
|
|
7154
|
+
exclude_from_blockchain=exclude_from_blockchain,
|
|
6955
7155
|
exclude_unique=exclude_unique,
|
|
6956
7156
|
sort_by_price=sort_by_price,
|
|
6957
7157
|
offset=offset,
|
|
@@ -6959,6 +7159,7 @@ class TeleBot:
|
|
|
6959
7159
|
)
|
|
6960
7160
|
)
|
|
6961
7161
|
|
|
7162
|
+
|
|
6962
7163
|
def convert_gift_to_stars(self, business_connection_id: str, owned_gift_id: str) -> bool:
|
|
6963
7164
|
"""
|
|
6964
7165
|
Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.
|
|
@@ -7096,6 +7297,50 @@ class TeleBot:
|
|
|
7096
7297
|
)
|
|
7097
7298
|
)
|
|
7098
7299
|
|
|
7300
|
+
def repost_story(
|
|
7301
|
+
self, business_connection_id: str,
|
|
7302
|
+
from_chat_id: int, from_story_id: int,
|
|
7303
|
+
active_period: int,
|
|
7304
|
+
post_to_chat_page: Optional[bool]=None,
|
|
7305
|
+
protect_content: Optional[bool]=None) -> types.Story:
|
|
7306
|
+
"""
|
|
7307
|
+
Reposts a story on behalf of a business account from another business account. Both business accounts
|
|
7308
|
+
must be managed by the same bot, and the story on the source account must have been posted (or reposted)
|
|
7309
|
+
by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.
|
|
7310
|
+
|
|
7311
|
+
Telegram documentation: https://core.telegram.org/bots/api#repoststory
|
|
7312
|
+
|
|
7313
|
+
:param business_connection_id: Unique identifier of the business connection
|
|
7314
|
+
:type business_connection_id: :obj:`str`
|
|
7315
|
+
|
|
7316
|
+
:param from_chat_id: Unique identifier of the chat which posted the story that should be reposted
|
|
7317
|
+
:type from_chat_id: :obj:`int`
|
|
7318
|
+
|
|
7319
|
+
:param from_story_id: Unique identifier of the story that should be reposted
|
|
7320
|
+
:type from_story_id: :obj:`int`
|
|
7321
|
+
|
|
7322
|
+
:param active_period: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
|
|
7323
|
+
:type active_period: :obj:`int`
|
|
7324
|
+
|
|
7325
|
+
:param post_to_chat_page: Pass True to keep the story accessible after it expires
|
|
7326
|
+
:type post_to_chat_page: :obj:`bool`
|
|
7327
|
+
|
|
7328
|
+
:param protect_content: Pass True if the content of the story must be protected from forwarding and screenshotting
|
|
7329
|
+
:type protect_content: :obj:`bool`
|
|
7330
|
+
|
|
7331
|
+
:return: On success, a Story object is returned.
|
|
7332
|
+
:rtype: :class:`telebot.types.Story`
|
|
7333
|
+
"""
|
|
7334
|
+
return types.Story.de_json(
|
|
7335
|
+
apihelper.repost_story(
|
|
7336
|
+
self.token, business_connection_id,
|
|
7337
|
+
from_chat_id, from_story_id,
|
|
7338
|
+
active_period,
|
|
7339
|
+
post_to_chat_page=post_to_chat_page,
|
|
7340
|
+
protect_content=protect_content
|
|
7341
|
+
)
|
|
7342
|
+
)
|
|
7343
|
+
|
|
7099
7344
|
def edit_story(
|
|
7100
7345
|
self, business_connection_id: str, story_id: int,
|
|
7101
7346
|
content: types.InputStoryContent,
|
telebot/apihelper.py
CHANGED
|
@@ -432,7 +432,8 @@ def get_chat_member(token, chat_id, user_id):
|
|
|
432
432
|
def forward_message(
|
|
433
433
|
token, chat_id, from_chat_id, message_id,
|
|
434
434
|
disable_notification=None, timeout=None, protect_content=None, message_thread_id=None,
|
|
435
|
-
video_start_timestamp=None, direct_messages_topic_id=None, suggested_post_parameters=None
|
|
435
|
+
video_start_timestamp=None, direct_messages_topic_id=None, suggested_post_parameters=None,
|
|
436
|
+
message_effect_id=None):
|
|
436
437
|
method_url = r'forwardMessage'
|
|
437
438
|
payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id}
|
|
438
439
|
if disable_notification is not None:
|
|
@@ -449,13 +450,16 @@ def forward_message(
|
|
|
449
450
|
payload['direct_messages_topic_id'] = direct_messages_topic_id
|
|
450
451
|
if suggested_post_parameters is not None:
|
|
451
452
|
payload['suggested_post_parameters'] = suggested_post_parameters.to_json()
|
|
453
|
+
if message_effect_id:
|
|
454
|
+
payload['message_effect_id'] = message_effect_id
|
|
452
455
|
return _make_request(token, method_url, params=payload)
|
|
453
456
|
|
|
454
457
|
|
|
455
458
|
def copy_message(token, chat_id, from_chat_id, message_id, caption=None, parse_mode=None, caption_entities=None,
|
|
456
459
|
disable_notification=None, reply_markup=None, timeout=None, protect_content=None, message_thread_id=None,
|
|
457
460
|
reply_parameters=None, show_caption_above_media=None, allow_paid_broadcast=None,
|
|
458
|
-
video_start_timestamp=None, direct_messages_topic_id=None, suggested_post_parameters=None
|
|
461
|
+
video_start_timestamp=None, direct_messages_topic_id=None, suggested_post_parameters=None,
|
|
462
|
+
message_effect_id=None):
|
|
459
463
|
method_url = r'copyMessage'
|
|
460
464
|
payload = {'chat_id': chat_id, 'from_chat_id': from_chat_id, 'message_id': message_id}
|
|
461
465
|
if caption is not None:
|
|
@@ -486,6 +490,8 @@ def copy_message(token, chat_id, from_chat_id, message_id, caption=None, parse_m
|
|
|
486
490
|
payload['direct_messages_topic_id'] = direct_messages_topic_id
|
|
487
491
|
if suggested_post_parameters is not None:
|
|
488
492
|
payload['suggested_post_parameters'] = suggested_post_parameters.to_json()
|
|
493
|
+
if message_effect_id:
|
|
494
|
+
payload['message_effect_id'] = message_effect_id
|
|
489
495
|
return _make_request(token, method_url, params=payload)
|
|
490
496
|
|
|
491
497
|
def send_checklist(
|
|
@@ -848,6 +854,20 @@ def send_contact(
|
|
|
848
854
|
return _make_request(token, method_url, params=payload)
|
|
849
855
|
|
|
850
856
|
|
|
857
|
+
def send_message_draft(
|
|
858
|
+
token, chat_id, draft_id, text,
|
|
859
|
+
message_thread_id=None, parse_mode=None, entities=None):
|
|
860
|
+
method_url = r'sendMessageDraft'
|
|
861
|
+
payload = {'chat_id': chat_id, 'draft_id': draft_id, 'text': text}
|
|
862
|
+
if message_thread_id is not None:
|
|
863
|
+
payload['message_thread_id'] = message_thread_id
|
|
864
|
+
if parse_mode:
|
|
865
|
+
payload['parse_mode'] = parse_mode
|
|
866
|
+
if entities:
|
|
867
|
+
payload['entities'] = json.dumps(types.MessageEntity.to_list_of_dicts(entities))
|
|
868
|
+
return _make_request(token, method_url, params=payload)
|
|
869
|
+
|
|
870
|
+
|
|
851
871
|
def send_chat_action(token, chat_id, action, timeout=None, message_thread_id=None, business_connection_id=None):
|
|
852
872
|
method_url = r'sendChatAction'
|
|
853
873
|
payload = {'chat_id': chat_id, 'action': action}
|
|
@@ -2176,27 +2196,89 @@ def transfer_business_account_stars(token, business_connection_id, star_count):
|
|
|
2176
2196
|
return _make_request(token, method_url, params=payload, method='post')
|
|
2177
2197
|
|
|
2178
2198
|
def get_business_account_gifts(token, business_connection_id, exclude_unsaved=None, exclude_saved=None,
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2199
|
+
exclude_unlimited=None, exclude_unique=None,
|
|
2200
|
+
sort_by_price=None, offset=None, limit=None, exclude_limited_upgradable=None,
|
|
2201
|
+
exclude_limited_non_upgradable=None, exclude_from_blockchain=None):
|
|
2202
|
+
method_url = 'getBusinessAccountGifts'
|
|
2203
|
+
payload = {'business_connection_id': business_connection_id}
|
|
2204
|
+
if exclude_unsaved is not None:
|
|
2205
|
+
payload['exclude_unsaved'] = exclude_unsaved
|
|
2206
|
+
if exclude_saved is not None:
|
|
2207
|
+
payload['exclude_saved'] = exclude_saved
|
|
2208
|
+
if exclude_unlimited is not None:
|
|
2209
|
+
payload['exclude_unlimited'] = exclude_unlimited
|
|
2210
|
+
if exclude_unique is not None:
|
|
2211
|
+
payload['exclude_unique'] = exclude_unique
|
|
2212
|
+
if sort_by_price is not None:
|
|
2213
|
+
payload['sort_by_price'] = sort_by_price
|
|
2214
|
+
if offset is not None:
|
|
2215
|
+
payload['offset'] = offset
|
|
2216
|
+
if limit is not None:
|
|
2217
|
+
payload['limit'] = limit
|
|
2218
|
+
if exclude_limited_upgradable is not None:
|
|
2219
|
+
payload['exclude_limited_upgradable'] = exclude_limited_upgradable
|
|
2220
|
+
if exclude_limited_non_upgradable is not None:
|
|
2221
|
+
payload['exclude_limited_non_upgradable'] = exclude_limited_non_upgradable
|
|
2222
|
+
if exclude_from_blockchain is not None:
|
|
2223
|
+
payload['exclude_from_blockchain'] = exclude_from_blockchain
|
|
2224
|
+
|
|
2225
|
+
return _make_request(token, method_url, params=payload)
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
def get_user_gifts(token, user_id, exclude_unlimited=None, exclude_limited_upgradable=None,
|
|
2229
|
+
exclude_limited_non_upgradable=None, exclude_from_blockchain=None, exclude_unique=None,
|
|
2230
|
+
sort_by_price=None, offset=None, limit=None):
|
|
2231
|
+
method_url = 'getUserGifts'
|
|
2232
|
+
payload = {'user_id': user_id}
|
|
2233
|
+
if exclude_unlimited is not None:
|
|
2234
|
+
payload['exclude_unlimited'] = exclude_unlimited
|
|
2235
|
+
if exclude_limited_upgradable is not None:
|
|
2236
|
+
payload['exclude_limited_upgradable'] = exclude_limited_upgradable
|
|
2237
|
+
if exclude_limited_non_upgradable is not None:
|
|
2238
|
+
payload['exclude_limited_non_upgradable'] = exclude_limited_non_upgradable
|
|
2239
|
+
if exclude_from_blockchain is not None:
|
|
2240
|
+
payload['exclude_from_blockchain'] = exclude_from_blockchain
|
|
2241
|
+
if exclude_unique is not None:
|
|
2242
|
+
payload['exclude_unique'] = exclude_unique
|
|
2243
|
+
if sort_by_price is not None:
|
|
2244
|
+
payload['sort_by_price'] = sort_by_price
|
|
2245
|
+
if offset is None:
|
|
2246
|
+
payload['offset'] = ""
|
|
2247
|
+
else:
|
|
2248
|
+
payload['offset'] = offset
|
|
2249
|
+
if limit is not None:
|
|
2250
|
+
payload['limit'] = limit
|
|
2251
|
+
return _make_request(token, method_url, params=payload)
|
|
2252
|
+
|
|
2253
|
+
def get_chat_gifts(token, chat_id, exclude_unsaved=None, exclude_saved=None,
|
|
2254
|
+
exclude_unlimited=None, exclude_limited_upgradable=None,
|
|
2255
|
+
exclude_limited_non_upgradable=None, exclude_from_blockchain=None,
|
|
2256
|
+
exclude_unique=None, sort_by_price=None, offset=None, limit=None):
|
|
2257
|
+
method_url = 'getChatGifts'
|
|
2258
|
+
payload = {'chat_id': chat_id}
|
|
2259
|
+
if exclude_unsaved is not None:
|
|
2260
|
+
payload['exclude_unsaved'] = exclude_unsaved
|
|
2261
|
+
if exclude_saved is not None:
|
|
2262
|
+
payload['exclude_saved'] = exclude_saved
|
|
2263
|
+
if exclude_unlimited is not None:
|
|
2264
|
+
payload['exclude_unlimited'] = exclude_unlimited
|
|
2265
|
+
if exclude_limited_upgradable is not None:
|
|
2266
|
+
payload['exclude_limited_upgradable'] = exclude_limited_upgradable
|
|
2267
|
+
if exclude_limited_non_upgradable is not None:
|
|
2268
|
+
payload['exclude_limited_non_upgradable'] = exclude_limited_non_upgradable
|
|
2269
|
+
if exclude_from_blockchain is not None:
|
|
2270
|
+
payload['exclude_from_blockchain'] = exclude_from_blockchain
|
|
2271
|
+
if exclude_unique is not None:
|
|
2272
|
+
payload['exclude_unique'] = exclude_unique
|
|
2273
|
+
if sort_by_price is not None:
|
|
2274
|
+
payload['sort_by_price'] = sort_by_price
|
|
2275
|
+
if offset is None:
|
|
2276
|
+
payload['offset'] = ""
|
|
2277
|
+
else:
|
|
2278
|
+
payload['offset'] = offset
|
|
2279
|
+
if limit is not None:
|
|
2280
|
+
payload['limit'] = limit
|
|
2281
|
+
return _make_request(token, method_url, params=payload)
|
|
2200
2282
|
|
|
2201
2283
|
|
|
2202
2284
|
def convert_gift_to_stars(token, business_connection_id, owned_gift_id):
|
|
@@ -2242,6 +2324,20 @@ def post_story(token, business_connection_id, content, active_period, caption=No
|
|
|
2242
2324
|
payload['protect_content'] = protect_content
|
|
2243
2325
|
return _make_request(token, method_url, params=payload, files=files, method='post')
|
|
2244
2326
|
|
|
2327
|
+
|
|
2328
|
+
def repost_story(token, business_connection_id, from_chat_id, from_story_id, active_period,
|
|
2329
|
+
post_to_chat_page=None, protect_content=None):
|
|
2330
|
+
method_url = 'repostStory'
|
|
2331
|
+
payload = {'business_connection_id': business_connection_id, 'from_chat_id': from_chat_id,
|
|
2332
|
+
'from_story_id': from_story_id, 'active_period': active_period}
|
|
2333
|
+
|
|
2334
|
+
if post_to_chat_page is not None:
|
|
2335
|
+
payload['post_to_chat_page'] = post_to_chat_page
|
|
2336
|
+
if protect_content is not None:
|
|
2337
|
+
payload['protect_content'] = protect_content
|
|
2338
|
+
return _make_request(token, method_url, params=payload, method='post')
|
|
2339
|
+
|
|
2340
|
+
|
|
2245
2341
|
def edit_story(token, business_connection_id, story_id, content, caption=None, parse_mode=None,
|
|
2246
2342
|
caption_entities=None, areas=None):
|
|
2247
2343
|
method_url = 'editStory'
|