pyTelegramBotAPI 4.30.0__py3-none-any.whl → 4.32.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.30.0.dist-info → pytelegrambotapi-4.32.0.dist-info}/METADATA +3 -3
- pytelegrambotapi-4.32.0.dist-info/RECORD +42 -0
- {pytelegrambotapi-4.30.0.dist-info → pytelegrambotapi-4.32.0.dist-info}/WHEEL +1 -1
- telebot/__init__.py +82 -5
- telebot/apihelper.py +32 -1
- telebot/async_telebot.py +79 -5
- telebot/asyncio_filters.py +450 -450
- telebot/asyncio_handler_backends.py +98 -98
- telebot/asyncio_helper.py +35 -2
- telebot/asyncio_storage/__init__.py +13 -13
- telebot/asyncio_storage/base_storage.py +147 -147
- telebot/asyncio_storage/memory_storage.py +225 -225
- telebot/asyncio_storage/pickle_storage.py +274 -274
- telebot/asyncio_storage/redis_storage.py +339 -339
- telebot/custom_filters.py +455 -455
- telebot/formatting.py +497 -479
- telebot/handler_backends.py +257 -257
- telebot/states/__init__.py +128 -128
- telebot/states/asyncio/__init__.py +7 -7
- telebot/states/asyncio/context.py +153 -153
- telebot/states/asyncio/middleware.py +21 -21
- telebot/states/sync/__init__.py +6 -6
- telebot/states/sync/context.py +142 -142
- telebot/states/sync/middleware.py +21 -21
- telebot/storage/__init__.py +13 -13
- telebot/storage/base_storage.py +142 -142
- telebot/storage/memory_storage.py +225 -225
- telebot/storage/pickle_storage.py +263 -263
- telebot/storage/redis_storage.py +324 -324
- telebot/types.py +270 -30
- telebot/util.py +724 -724
- telebot/version.py +1 -1
- pytelegrambotapi-4.30.0.dist-info/RECORD +0 -42
- {pytelegrambotapi-4.30.0.dist-info → pytelegrambotapi-4.32.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.32.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
|
|
@@ -51,7 +51,7 @@ Description-Content-Type: text/markdown
|
|
|
51
51
|
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
|
|
52
52
|
<p align="center">Both synchronous and asynchronous.</p>
|
|
53
53
|
|
|
54
|
-
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#
|
|
54
|
+
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#march-1-2026"><img src="https://img.shields.io/badge/Bot%20API-9.5-blue?logo=telegram" alt="Supported Bot API version"></a>
|
|
55
55
|
|
|
56
56
|
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
|
|
57
57
|
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
|
|
@@ -843,7 +843,7 @@ Bot instances that were idle for a long time might be rejected by the server whe
|
|
|
843
843
|
|
|
844
844
|
Get help. Discuss. Chat.
|
|
845
845
|
|
|
846
|
-
* Join the [pyTelegramBotAPI Telegram Chat Group](https://
|
|
846
|
+
* Join the [pyTelegramBotAPI Telegram Chat Group](https://t.me/+GNAFesxfJ-o5OTRl)
|
|
847
847
|
|
|
848
848
|
## Telegram Channel
|
|
849
849
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
telebot/__init__.py,sha256=N66uzken5iV53MtWlKrwB3YcS6Ecnd3wCv3ny5qlFZU,499445
|
|
2
|
+
telebot/apihelper.py,sha256=Nd1XLwABjWw7X_BcJ87GghVqwHuZ1MR8KMGKW01cgWI,124058
|
|
3
|
+
telebot/async_telebot.py,sha256=pSBVbVCu_6WBS2eGC0Fc3IvvrsNOPEILKQsu9uBqRvI,473014
|
|
4
|
+
telebot/asyncio_filters.py,sha256=Mea64Q--9yznmy2YuLrK2gVXBtbDDFjlaTU6u6EwOlg,13307
|
|
5
|
+
telebot/asyncio_handler_backends.py,sha256=8yYMIIspdMKs-udbpLXUGZ1R-ZgW1Dz4vKjKmo_C4Zg,2883
|
|
6
|
+
telebot/asyncio_helper.py,sha256=_OS0nlnMVibqTa-D6HXVMnLCTU9__eKfCRK0hCJKgyQ,125373
|
|
7
|
+
telebot/callback_data.py,sha256=k4Rz3lAONG5J2M9TESKMIjqXoBNJMfEy9nnrmJAyi3Q,5358
|
|
8
|
+
telebot/custom_filters.py,sha256=ImvJ_gasI2NDbog2NBEkqUEQdVEzaONVOCaJwOTi-Mc,13430
|
|
9
|
+
telebot/formatting.py,sha256=hIaE3IiiumD6tf-X8DSDvFQyGHPq48nmEdLVJcr_nKQ,15950
|
|
10
|
+
telebot/handler_backends.py,sha256=t1j1sQVS511AcQYd73TrvlxpS6757UQ0cVmWrA9_kg4,8226
|
|
11
|
+
telebot/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
+
telebot/service_utils.py,sha256=xLmlZLTVs34UOdQtMvwduor8hnLxQCx8iJ92wDGl2Mw,2053
|
|
13
|
+
telebot/types.py,sha256=4-42IPSNjvGD_BGfNPjw3g8aHKw2SCIoYTapYJBrKwU,585087
|
|
14
|
+
telebot/util.py,sha256=YZfYvvIfptXN9ZnidGr7tbZSgiNY0mlo3zQOYwT1ngc,22524
|
|
15
|
+
telebot/version.py,sha256=WNORxQXzb_lRKkuKqIvZdOBq1oOOlaj8Dv539VW_D0g,99
|
|
16
|
+
telebot/asyncio_storage/__init__.py,sha256=DpVFdTvFpJveTbHY2CezqGWjHKjG__qMdmJvFEc_ekw,446
|
|
17
|
+
telebot/asyncio_storage/base_storage.py,sha256=T5FWpT057w-FSbprDBCEY2P1wzdrYoe8yonBOJLpSQs,3966
|
|
18
|
+
telebot/asyncio_storage/memory_storage.py,sha256=XQO8hYPBOenrv8KHd3Bzj8Eg7OCmvJV4rbmKJPl5eB0,6074
|
|
19
|
+
telebot/asyncio_storage/pickle_storage.py,sha256=LEwWu_hMSaUKIJT1nOkeIBRdzLEZIF4anInMOKOlkRs,7936
|
|
20
|
+
telebot/asyncio_storage/redis_storage.py,sha256=rDCkS8u3lMVJ-JYFj9k5rDhz6WH9wwGdhSf9_bgiIzk,10236
|
|
21
|
+
telebot/ext/__init__.py,sha256=_mSeNU1cib3cWSZ6Kb6nKy9znEYwEzGNRCYZsD61rLk,66
|
|
22
|
+
telebot/ext/reloader.py,sha256=vzmJxCsA_COHF-bpmyddDuUXroxNih051IYRMiR21LY,826
|
|
23
|
+
telebot/ext/aio/__init__.py,sha256=2yi7jtvEIH1DqAseFevfujNYi7ZSh5aPMOKGrxIgqsw,143
|
|
24
|
+
telebot/ext/aio/webhooks.py,sha256=tf4DMXkKWvM_Uko_lpLRc0uDwttyZGvsvDLNNbwmO_Y,3788
|
|
25
|
+
telebot/ext/sync/__init__.py,sha256=Lj-15dj1TYkf11d0vY14_2mssnoFR5Uk320huWa_rGc,140
|
|
26
|
+
telebot/ext/sync/webhooks.py,sha256=XMMhXnDuFs7CWJ7iDi11H0dwf6fRA4pbAjFjNgNJ18Y,3513
|
|
27
|
+
telebot/states/__init__.py,sha256=LHXRkVrbx8ig_UBtNeYKLdF3HkkzJzkKs2EU23bhwiI,4529
|
|
28
|
+
telebot/states/asyncio/__init__.py,sha256=GOj426jeWP2nuScz4SPRY3FcWZ9V7jE0iUR0B_spyUw,139
|
|
29
|
+
telebot/states/asyncio/context.py,sha256=Mk8rgTmlM-cdpsN6GKUratJE4E6wkzjGo2PyLYtedw4,5101
|
|
30
|
+
telebot/states/asyncio/middleware.py,sha256=JNaDTJ-rE_J6X4UfS0F8rIKUWYrCw5GowdJ8MnRFAzA,751
|
|
31
|
+
telebot/states/sync/__init__.py,sha256=4uC-5KHK3h2rsFcv98pDcLI3dzPet0aRB8x-2M0sMWE,137
|
|
32
|
+
telebot/states/sync/context.py,sha256=Re5448GjbI_GfKpJh-MeDKDNHxodr7y2dTpgERcrB1s,4873
|
|
33
|
+
telebot/states/sync/middleware.py,sha256=lkstXtC_35bZAajVeMkdepbVNK1Yir3XApDzEnMnIiM,701
|
|
34
|
+
telebot/storage/__init__.py,sha256=SJFXvAu45CH35oQgmwsV2PpwynvSmRAzKQU40x2eUWA,414
|
|
35
|
+
telebot/storage/base_storage.py,sha256=Xcgb2LdGV_5L16W1TnRXG0tvkopNCf9xh37ri1XzaqE,3704
|
|
36
|
+
telebot/storage/memory_storage.py,sha256=PNDLz67TMioY_A-po9la4-qblIdoCERh7fHU18KqIeU,6024
|
|
37
|
+
telebot/storage/pickle_storage.py,sha256=6vvR8vzNE0SUKiAYP_bM3Cx9if4-xLNOMkHvJtdgbM4,7399
|
|
38
|
+
telebot/storage/redis_storage.py,sha256=WY8khaSVmEkJO6kQbQ-t916564BIwX2kinUMg_wLLDM,9774
|
|
39
|
+
pytelegrambotapi-4.32.0.dist-info/METADATA,sha256=y1OsQhZ_zb0FXmnQP3efWbRBIk6loiULhqeOb9VR3G4,48258
|
|
40
|
+
pytelegrambotapi-4.32.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
41
|
+
pytelegrambotapi-4.32.0.dist-info/licenses/LICENSE,sha256=qz_jTTxi4zSAFaTdASiwml2iAk0UZ6R4MRADNzwYo_A,18387
|
|
42
|
+
pytelegrambotapi-4.32.0.dist-info/RECORD,,
|
telebot/__init__.py
CHANGED
|
@@ -1512,6 +1512,29 @@ class TeleBot:
|
|
|
1512
1512
|
apihelper.get_user_profile_photos(self.token, user_id, offset=offset, limit=limit)
|
|
1513
1513
|
)
|
|
1514
1514
|
|
|
1515
|
+
def get_user_profile_audios(self, user_id: int, offset: Optional[int]=None,
|
|
1516
|
+
limit: Optional[int]=None) -> types.UserProfileAudios:
|
|
1517
|
+
"""
|
|
1518
|
+
Use this method to get a list of profile audios for a user. Returns a :class:`telebot.types.UserProfileAudios` object.
|
|
1519
|
+
|
|
1520
|
+
Telegram documentation: https://core.telegram.org/bots/api#getuserprofileaudios
|
|
1521
|
+
|
|
1522
|
+
:param user_id: Unique identifier of the target user
|
|
1523
|
+
:type user_id: :obj:`int`
|
|
1524
|
+
|
|
1525
|
+
:param offset: Sequential number of the first audio to be returned. By default, all audios are returned.
|
|
1526
|
+
:type offset: :obj:`int`
|
|
1527
|
+
|
|
1528
|
+
:param limit: Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
|
|
1529
|
+
:type limit: :obj:`int`
|
|
1530
|
+
|
|
1531
|
+
:return: If the request is successful, a UserProfileAudios object is returned.
|
|
1532
|
+
:rtype: :class:`telebot.types.UserProfileAudios`
|
|
1533
|
+
"""
|
|
1534
|
+
return types.UserProfileAudios.de_json(
|
|
1535
|
+
apihelper.get_user_profile_audios(self.token, user_id, offset=offset, limit=limit)
|
|
1536
|
+
)
|
|
1537
|
+
|
|
1515
1538
|
def set_user_emoji_status(self, user_id: int, emoji_status_custom_emoji_id: Optional[str]=None, emoji_status_expiration_date: Optional[int]=None) -> bool:
|
|
1516
1539
|
"""
|
|
1517
1540
|
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.
|
|
@@ -4214,7 +4237,7 @@ class TeleBot:
|
|
|
4214
4237
|
entities: Optional[List[types.MessageEntity]]=None):
|
|
4215
4238
|
"""
|
|
4216
4239
|
Use this method to stream a partial message to a user while the message is being generated;
|
|
4217
|
-
|
|
4240
|
+
available for all bots. Returns True on success.
|
|
4218
4241
|
|
|
4219
4242
|
Telegram documentation: https://core.telegram.org/bots/api#sendmessagedraft
|
|
4220
4243
|
|
|
@@ -4464,7 +4487,8 @@ class TeleBot:
|
|
|
4464
4487
|
can_post_stories: Optional[bool]=None,
|
|
4465
4488
|
can_edit_stories: Optional[bool]=None,
|
|
4466
4489
|
can_delete_stories: Optional[bool]=None,
|
|
4467
|
-
can_manage_direct_messages: Optional[bool]=None
|
|
4490
|
+
can_manage_direct_messages: Optional[bool]=None,
|
|
4491
|
+
can_manage_tags: Optional[bool]=None) -> bool:
|
|
4468
4492
|
"""
|
|
4469
4493
|
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator
|
|
4470
4494
|
in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -4538,6 +4562,9 @@ class TeleBot:
|
|
|
4538
4562
|
within the channel and decline suggested posts; for channels only
|
|
4539
4563
|
:type can_manage_direct_messages: :obj:`bool`
|
|
4540
4564
|
|
|
4565
|
+
:param can_manage_tags: Pass True if the administrator can manage tags in the chat
|
|
4566
|
+
:type can_manage_tags: :obj:`bool`
|
|
4567
|
+
|
|
4541
4568
|
:return: True on success.
|
|
4542
4569
|
:rtype: :obj:`bool`
|
|
4543
4570
|
"""
|
|
@@ -4555,6 +4582,7 @@ class TeleBot:
|
|
|
4555
4582
|
can_manage_video_chats=can_manage_video_chats, can_manage_topics=can_manage_topics,
|
|
4556
4583
|
can_post_stories=can_post_stories, can_edit_stories=can_edit_stories,
|
|
4557
4584
|
can_delete_stories=can_delete_stories, can_manage_direct_messages=can_manage_direct_messages,
|
|
4585
|
+
can_manage_tags=can_manage_tags,
|
|
4558
4586
|
)
|
|
4559
4587
|
|
|
4560
4588
|
|
|
@@ -4583,6 +4611,30 @@ class TeleBot:
|
|
|
4583
4611
|
return apihelper.set_chat_administrator_custom_title(self.token, chat_id, user_id, custom_title)
|
|
4584
4612
|
|
|
4585
4613
|
|
|
4614
|
+
def set_chat_member_tag(
|
|
4615
|
+
self, chat_id: Union[int, str], user_id: int, tag: Optional[str]=None) -> bool:
|
|
4616
|
+
"""
|
|
4617
|
+
Use this method to set a new tag for a member in a chat.
|
|
4618
|
+
Returns True on success.
|
|
4619
|
+
|
|
4620
|
+
Telegram documentation: https://core.telegram.org/bots/api#setchatmembertag
|
|
4621
|
+
|
|
4622
|
+
:param chat_id: Unique identifier for the target chat or username of the target supergroup
|
|
4623
|
+
(in the format @supergroupusername)
|
|
4624
|
+
:type chat_id: :obj:`int` or :obj:`str`
|
|
4625
|
+
|
|
4626
|
+
:param user_id: Unique identifier of the target user
|
|
4627
|
+
:type user_id: :obj:`int`
|
|
4628
|
+
|
|
4629
|
+
:param tag: New tag for the member; pass an empty string to remove the tag
|
|
4630
|
+
:type tag: :obj:`str`
|
|
4631
|
+
|
|
4632
|
+
:return: True on success.
|
|
4633
|
+
:rtype: :obj:`bool`
|
|
4634
|
+
"""
|
|
4635
|
+
return apihelper.set_chat_member_tag(self.token, chat_id, user_id, tag=tag)
|
|
4636
|
+
|
|
4637
|
+
|
|
4586
4638
|
def ban_chat_sender_chat(self, chat_id: Union[int, str], sender_chat_id: Union[int, str]) -> bool:
|
|
4587
4639
|
"""
|
|
4588
4640
|
Use this method to ban a channel chat in a supergroup or a channel.
|
|
@@ -5048,6 +5100,31 @@ class TeleBot:
|
|
|
5048
5100
|
return types.BotShortDescription.de_json(
|
|
5049
5101
|
apihelper.get_my_short_description(self.token, language_code=language_code))
|
|
5050
5102
|
|
|
5103
|
+
def set_my_profile_photo(self, photo: types.InputProfilePhoto) -> bool:
|
|
5104
|
+
"""
|
|
5105
|
+
Use this method to change the profile photo of the bot. Returns True on success.
|
|
5106
|
+
|
|
5107
|
+
Telegram documentation: https://core.telegram.org/bots/api#setmyprofilephoto
|
|
5108
|
+
|
|
5109
|
+
:param photo: The new profile photo to set
|
|
5110
|
+
:type photo: :class:`telebot.types.InputProfilePhoto`
|
|
5111
|
+
|
|
5112
|
+
:return: True on success.
|
|
5113
|
+
:rtype: :obj:`bool`
|
|
5114
|
+
"""
|
|
5115
|
+
return apihelper.set_my_profile_photo(self.token, photo)
|
|
5116
|
+
|
|
5117
|
+
def remove_my_profile_photo(self) -> bool:
|
|
5118
|
+
"""
|
|
5119
|
+
Use this method to remove the profile photo of the bot. Requires no parameters. Returns True on success.
|
|
5120
|
+
|
|
5121
|
+
Telegram documentation: https://core.telegram.org/bots/api#removemyprofilephoto
|
|
5122
|
+
|
|
5123
|
+
:return: True on success.
|
|
5124
|
+
:rtype: :obj:`bool`
|
|
5125
|
+
"""
|
|
5126
|
+
return apihelper.remove_my_profile_photo(self.token)
|
|
5127
|
+
|
|
5051
5128
|
|
|
5052
5129
|
def set_chat_menu_button(self, chat_id: Union[int, str]=None, menu_button: types.MenuButton=None) -> bool:
|
|
5053
5130
|
"""
|
|
@@ -7758,7 +7835,7 @@ class TeleBot:
|
|
|
7758
7835
|
|
|
7759
7836
|
:param sticker: File identifier of the sticker
|
|
7760
7837
|
:return: On success, True is returned.
|
|
7761
|
-
|
|
7838
|
+
:rtype: :obj:`bool`
|
|
7762
7839
|
"""
|
|
7763
7840
|
return apihelper.delete_sticker_from_set(self.token, sticker)
|
|
7764
7841
|
|
|
@@ -7767,8 +7844,8 @@ class TeleBot:
|
|
|
7767
7844
|
chat_id: int, name: str, icon_color: Optional[int]=None,
|
|
7768
7845
|
icon_custom_emoji_id: Optional[str]=None) -> types.ForumTopic:
|
|
7769
7846
|
"""
|
|
7770
|
-
Use this method to create a topic in a forum supergroup chat.
|
|
7771
|
-
in the chat for this to work and must have the can_manage_topics administrator
|
|
7847
|
+
Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot
|
|
7848
|
+
must be an administrator in the chat for this to work and must have the can_manage_topics administrator right.
|
|
7772
7849
|
Returns information about the created topic as a ForumTopic object.
|
|
7773
7850
|
|
|
7774
7851
|
Telegram documentation: https://core.telegram.org/bots/api#createforumtopic
|
telebot/apihelper.py
CHANGED
|
@@ -349,6 +349,16 @@ def get_user_profile_photos(token, user_id, offset=None, limit=None):
|
|
|
349
349
|
return _make_request(token, method_url, params=payload)
|
|
350
350
|
|
|
351
351
|
|
|
352
|
+
def get_user_profile_audios(token, user_id, offset=None, limit=None):
|
|
353
|
+
method_url = r'getUserProfileAudios'
|
|
354
|
+
payload = {'user_id': user_id}
|
|
355
|
+
if offset:
|
|
356
|
+
payload['offset'] = offset
|
|
357
|
+
if limit:
|
|
358
|
+
payload['limit'] = limit
|
|
359
|
+
return _make_request(token, method_url, params=payload)
|
|
360
|
+
|
|
361
|
+
|
|
352
362
|
def set_user_emoji_status(token, user_id, emoji_status_custom_emoji_id=None, emoji_status_expiration_date=None):
|
|
353
363
|
method_url = r'setUserEmojiStatus'
|
|
354
364
|
payload = {'user_id': user_id}
|
|
@@ -1277,7 +1287,7 @@ def promote_chat_member(
|
|
|
1277
1287
|
can_restrict_members=None, can_pin_messages=None, can_promote_members=None,
|
|
1278
1288
|
is_anonymous=None, can_manage_chat=None, can_manage_video_chats=None,
|
|
1279
1289
|
can_manage_topics=None, can_post_stories=None, can_edit_stories=None,
|
|
1280
|
-
can_delete_stories=None, can_manage_direct_messages=None):
|
|
1290
|
+
can_delete_stories=None, can_manage_direct_messages=None, can_manage_tags=None):
|
|
1281
1291
|
method_url = 'promoteChatMember'
|
|
1282
1292
|
payload = {'chat_id': chat_id, 'user_id': user_id}
|
|
1283
1293
|
if can_change_info is not None:
|
|
@@ -1312,6 +1322,8 @@ def promote_chat_member(
|
|
|
1312
1322
|
payload['can_delete_stories'] = can_delete_stories
|
|
1313
1323
|
if can_manage_direct_messages is not None:
|
|
1314
1324
|
payload['can_manage_direct_messages'] = can_manage_direct_messages
|
|
1325
|
+
if can_manage_tags is not None:
|
|
1326
|
+
payload['can_manage_tags'] = can_manage_tags
|
|
1315
1327
|
return _make_request(token, method_url, params=payload, method='post')
|
|
1316
1328
|
|
|
1317
1329
|
|
|
@@ -1323,6 +1335,14 @@ def set_chat_administrator_custom_title(token, chat_id, user_id, custom_title):
|
|
|
1323
1335
|
return _make_request(token, method_url, params=payload, method='post')
|
|
1324
1336
|
|
|
1325
1337
|
|
|
1338
|
+
def set_chat_member_tag(token, chat_id, user_id, tag=None):
|
|
1339
|
+
method_url = 'setChatMemberTag'
|
|
1340
|
+
payload = {'chat_id': chat_id, 'user_id': user_id}
|
|
1341
|
+
if tag is not None:
|
|
1342
|
+
payload['tag'] = tag
|
|
1343
|
+
return _make_request(token, method_url, params=payload, method='post')
|
|
1344
|
+
|
|
1345
|
+
|
|
1326
1346
|
def ban_chat_sender_chat(token, chat_id, sender_chat_id):
|
|
1327
1347
|
method_url = 'banChatSenderChat'
|
|
1328
1348
|
payload = {'chat_id': chat_id, 'sender_chat_id': sender_chat_id}
|
|
@@ -1526,6 +1546,17 @@ def get_my_name(token, language_code=None):
|
|
|
1526
1546
|
payload['language_code'] = language_code
|
|
1527
1547
|
return _make_request(token, method_url, params=payload)
|
|
1528
1548
|
|
|
1549
|
+
def set_my_profile_photo(token, photo):
|
|
1550
|
+
method_url = r'setMyProfilePhoto'
|
|
1551
|
+
payload = {}
|
|
1552
|
+
photo_json, files = photo.convert_input_profile_photo()
|
|
1553
|
+
payload['photo'] = photo_json
|
|
1554
|
+
return _make_request(token, method_url, params=payload, files=files, method='post')
|
|
1555
|
+
|
|
1556
|
+
def delete_my_profile_photo(token):
|
|
1557
|
+
method_url = r'deleteMyProfilePhoto'
|
|
1558
|
+
return _make_request(token, method_url, method='post')
|
|
1559
|
+
|
|
1529
1560
|
def set_chat_menu_button(token, chat_id=None, menu_button=None):
|
|
1530
1561
|
method_url = r'setChatMenuButton'
|
|
1531
1562
|
payload = {}
|
telebot/async_telebot.py
CHANGED
|
@@ -2989,6 +2989,26 @@ class AsyncTeleBot:
|
|
|
2989
2989
|
result = await asyncio_helper.get_user_profile_photos(self.token, user_id, offset, limit)
|
|
2990
2990
|
return types.UserProfilePhotos.de_json(result)
|
|
2991
2991
|
|
|
2992
|
+
async def get_user_profile_audios(self, user_id: int, offset: Optional[int]=None, limit: Optional[int]=None) -> types.UserProfileAudios:
|
|
2993
|
+
"""
|
|
2994
|
+
Use this method to get a list of profile audios for a user. Returns a UserProfileAudios object.
|
|
2995
|
+
|
|
2996
|
+
Telegram documentation: https://core.telegram.org/bots/api#getuserprofileaudios
|
|
2997
|
+
|
|
2998
|
+
:param user_id: Unique identifier of the target user
|
|
2999
|
+
:type user_id: :obj:`int`
|
|
3000
|
+
|
|
3001
|
+
:param offset: Sequential number of the first audio to be returned. By default, all audios are returned.
|
|
3002
|
+
:type offset: :obj:`int`
|
|
3003
|
+
|
|
3004
|
+
:param limit: Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults to 100.
|
|
3005
|
+
:type limit: :obj:`int`
|
|
3006
|
+
|
|
3007
|
+
:return: If successful, returns a UserProfileAudios object.
|
|
3008
|
+
:rtype: :class:`telebot.types.UserProfileAudios`
|
|
3009
|
+
"""
|
|
3010
|
+
return types.UserProfileAudios.de_json(await asyncio_helper.get_user_profile_audios(self.token, user_id, offset=offset, limit=limit))
|
|
3011
|
+
|
|
2992
3012
|
async def set_user_emoji_status(self, user_id: int, emoji_status_custom_emoji_id: Optional[str]=None, emoji_status_expiration_date: Optional[int]=None) -> bool:
|
|
2993
3013
|
"""
|
|
2994
3014
|
Use this method to change the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess.
|
|
@@ -5737,7 +5757,7 @@ class AsyncTeleBot:
|
|
|
5737
5757
|
entities: Optional[List[types.MessageEntity]]=None):
|
|
5738
5758
|
"""
|
|
5739
5759
|
Use this method to stream a partial message to a user while the message is being generated;
|
|
5740
|
-
|
|
5760
|
+
available for all bots. Returns True on success.
|
|
5741
5761
|
|
|
5742
5762
|
Telegram documentation: https://core.telegram.org/bots/api#sendmessagedraft
|
|
5743
5763
|
|
|
@@ -5976,7 +5996,8 @@ class AsyncTeleBot:
|
|
|
5976
5996
|
can_post_stories: Optional[bool]=None,
|
|
5977
5997
|
can_edit_stories: Optional[bool]=None,
|
|
5978
5998
|
can_delete_stories: Optional[bool]=None,
|
|
5979
|
-
can_manage_direct_messages: Optional[bool]=None
|
|
5999
|
+
can_manage_direct_messages: Optional[bool]=None,
|
|
6000
|
+
can_manage_tags: Optional[bool]=None) -> bool:
|
|
5980
6001
|
"""
|
|
5981
6002
|
Use this method to promote or demote a user in a supergroup or a channel. The bot must be an administrator
|
|
5982
6003
|
in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -6050,6 +6071,9 @@ class AsyncTeleBot:
|
|
|
6050
6071
|
within the channel and decline suggested posts; for channels only
|
|
6051
6072
|
:type can_manage_direct_messages: :obj:`bool`
|
|
6052
6073
|
|
|
6074
|
+
:param can_manage_tags: Pass True if the administrator can manage tags in the chat
|
|
6075
|
+
:type can_manage_tags: :obj:`bool`
|
|
6076
|
+
|
|
6053
6077
|
:return: True on success.
|
|
6054
6078
|
:rtype: :obj:`bool`
|
|
6055
6079
|
"""
|
|
@@ -6064,7 +6088,8 @@ class AsyncTeleBot:
|
|
|
6064
6088
|
can_edit_messages, can_delete_messages, can_invite_users,
|
|
6065
6089
|
can_restrict_members, can_pin_messages, can_promote_members,
|
|
6066
6090
|
is_anonymous, can_manage_chat, can_manage_video_chats, can_manage_topics,
|
|
6067
|
-
can_post_stories, can_edit_stories, can_delete_stories,
|
|
6091
|
+
can_post_stories, can_edit_stories, can_delete_stories,
|
|
6092
|
+
can_manage_direct_messages=can_manage_direct_messages, can_manage_tags=can_manage_tags
|
|
6068
6093
|
)
|
|
6069
6094
|
|
|
6070
6095
|
async def set_chat_administrator_custom_title(
|
|
@@ -6092,6 +6117,30 @@ class AsyncTeleBot:
|
|
|
6092
6117
|
return await asyncio_helper.set_chat_administrator_custom_title(self.token, chat_id, user_id, custom_title)
|
|
6093
6118
|
|
|
6094
6119
|
|
|
6120
|
+
async def set_chat_member_tag(
|
|
6121
|
+
self, chat_id: Union[int, str], user_id: int, tag: Optional[str]=None) -> bool:
|
|
6122
|
+
"""
|
|
6123
|
+
Use this method to set a new tag for a member in a chat.
|
|
6124
|
+
Returns True on success.
|
|
6125
|
+
|
|
6126
|
+
Telegram documentation: https://core.telegram.org/bots/api#setchatmembertag
|
|
6127
|
+
|
|
6128
|
+
:param chat_id: Unique identifier for the target chat or username of the target supergroup
|
|
6129
|
+
(in the format @supergroupusername)
|
|
6130
|
+
:type chat_id: :obj:`int` or :obj:`str`
|
|
6131
|
+
|
|
6132
|
+
:param user_id: Unique identifier of the target user
|
|
6133
|
+
:type user_id: :obj:`int`
|
|
6134
|
+
|
|
6135
|
+
:param tag: New tag for the member; pass an empty string to remove the tag
|
|
6136
|
+
:type tag: :obj:`str`
|
|
6137
|
+
|
|
6138
|
+
:return: True on success.
|
|
6139
|
+
:rtype: :obj:`bool`
|
|
6140
|
+
"""
|
|
6141
|
+
return await asyncio_helper.set_chat_member_tag(self.token, chat_id, user_id, tag=tag)
|
|
6142
|
+
|
|
6143
|
+
|
|
6095
6144
|
async def ban_chat_sender_chat(self, chat_id: Union[int, str], sender_chat_id: Union[int, str]) -> bool:
|
|
6096
6145
|
"""
|
|
6097
6146
|
Use this method to ban a channel chat in a supergroup or a channel.
|
|
@@ -6533,6 +6582,31 @@ class AsyncTeleBot:
|
|
|
6533
6582
|
result = await asyncio_helper.get_my_name(self.token, language_code)
|
|
6534
6583
|
return types.BotName.de_json(result)
|
|
6535
6584
|
|
|
6585
|
+
async def set_my_profile_photo(self, photo: types.InputProfilePhoto) -> bool:
|
|
6586
|
+
"""
|
|
6587
|
+
Use this method to change the profile photo of the bot. Returns True on success.
|
|
6588
|
+
|
|
6589
|
+
Telegram documentation: https://core.telegram.org/bots/api#setmyprofilephoto
|
|
6590
|
+
|
|
6591
|
+
:param photo: InputProfilePhoto: The new profile photo to set
|
|
6592
|
+
:type photo: :class:`telebot.types.InputProfilePhoto`
|
|
6593
|
+
|
|
6594
|
+
:return: True on success.
|
|
6595
|
+
:rtype: :obj:`bool`
|
|
6596
|
+
"""
|
|
6597
|
+
return await asyncio_helper.set_my_profile_photo(self.token, photo)
|
|
6598
|
+
|
|
6599
|
+
async def remove_my_profile_photo(self) -> bool:
|
|
6600
|
+
"""
|
|
6601
|
+
Use this method to remove the profile photo of the bot. Requires no parameters. Returns True on success.
|
|
6602
|
+
|
|
6603
|
+
Telegram documentation: https://core.telegram.org/bots/api#removemyprofilephoto
|
|
6604
|
+
|
|
6605
|
+
:return: True on success.
|
|
6606
|
+
:rtype: :obj:`bool`
|
|
6607
|
+
"""
|
|
6608
|
+
return await asyncio_helper.remove_my_profile_photo(self.token)
|
|
6609
|
+
|
|
6536
6610
|
async def set_chat_menu_button(self, chat_id: Union[int, str]=None,
|
|
6537
6611
|
menu_button: types.MenuButton=None) -> bool:
|
|
6538
6612
|
"""
|
|
@@ -9193,8 +9267,8 @@ class AsyncTeleBot:
|
|
|
9193
9267
|
chat_id: int, name: str, icon_color: Optional[int]=None,
|
|
9194
9268
|
icon_custom_emoji_id: Optional[str]=None) -> types.ForumTopic:
|
|
9195
9269
|
"""
|
|
9196
|
-
Use this method to create a topic in a forum supergroup chat.
|
|
9197
|
-
in the chat for this to work and must have the can_manage_topics administrator
|
|
9270
|
+
Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot
|
|
9271
|
+
must be an administrator in the chat for this to work and must have the can_manage_topics administrator right.
|
|
9198
9272
|
Returns information about the created topic as a ForumTopic object.
|
|
9199
9273
|
|
|
9200
9274
|
Telegram documentation: https://core.telegram.org/bots/api#createforumtopic
|