pyTelegramBotAPI 4.21.0__py3-none-any.whl → 4.22.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.21.0.dist-info → pytelegrambotapi-4.22.0.dist-info}/METADATA +2 -2
- {pytelegrambotapi-4.21.0.dist-info → pytelegrambotapi-4.22.0.dist-info}/RECORD +12 -12
- telebot/__init__.py +14 -6
- telebot/apihelper.py +6 -2
- telebot/async_telebot.py +13 -7
- telebot/asyncio_filters.py +454 -454
- telebot/asyncio_helper.py +6 -2
- telebot/formatting.py +474 -463
- telebot/types.py +670 -589
- telebot/version.py +1 -1
- {pytelegrambotapi-4.21.0.dist-info → pytelegrambotapi-4.22.0.dist-info}/WHEEL +0 -0
- {pytelegrambotapi-4.21.0.dist-info → pytelegrambotapi-4.22.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: pyTelegramBotAPI
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.22.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
|
|
@@ -55,7 +55,7 @@ Description-Content-Type: text/markdown
|
|
|
55
55
|
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
|
|
56
56
|
<p align="center">Both synchronous and asynchronous.</p>
|
|
57
57
|
|
|
58
|
-
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#july-
|
|
58
|
+
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api-changelog#july-31-2024">7.8</a>!
|
|
59
59
|
|
|
60
60
|
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
|
|
61
61
|
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
telebot/__init__.py,sha256=
|
|
2
|
-
telebot/apihelper.py,sha256=
|
|
3
|
-
telebot/async_telebot.py,sha256=
|
|
4
|
-
telebot/asyncio_filters.py,sha256=
|
|
1
|
+
telebot/__init__.py,sha256=RwAiyWlfVe3nTZTJEKfNkj-NBTf3JRCD7CiqE-NeuwE,406863
|
|
2
|
+
telebot/apihelper.py,sha256=FJwcuzZXK54GqNmUiziobpbgrN5pwk_LcPBbkhlINf4,94286
|
|
3
|
+
telebot/async_telebot.py,sha256=wTdOtIA2FiGamUBm3yRgTqRG7viQpo6LSaSZbDKuDK0,380093
|
|
4
|
+
telebot/asyncio_filters.py,sha256=6vpIqxQhToiuxx4IsmzxrSFudWPJrhzo6XZT9JKMwWc,13014
|
|
5
5
|
telebot/asyncio_handler_backends.py,sha256=IujW69w8sQ8Kc2gogppiTWi2DgQ7kcmCjbgPXNTnO7U,3893
|
|
6
|
-
telebot/asyncio_helper.py,sha256=
|
|
6
|
+
telebot/asyncio_helper.py,sha256=Wvd8i8KFqGizkyaL7xZfb4Woan1yphoQGFYHvdErKyw,95049
|
|
7
7
|
telebot/callback_data.py,sha256=k4Rz3lAONG5J2M9TESKMIjqXoBNJMfEy9nnrmJAyi3Q,5358
|
|
8
8
|
telebot/custom_filters.py,sha256=biuxaoRfgKR8dx5Ev0UhlGxZSXOFuJsiw1VGz7f6Fcs,13172
|
|
9
|
-
telebot/formatting.py,sha256=
|
|
9
|
+
telebot/formatting.py,sha256=_y8M5KOv9UOXfF9z7Et4fPVgh9JnzI1cr4un9sfdlc0,15176
|
|
10
10
|
telebot/handler_backends.py,sha256=fW0vAo4luo99e4hWMktuow55_G1o6UUiBlU5kY08aKY,9210
|
|
11
11
|
telebot/service_utils.py,sha256=xLmlZLTVs34UOdQtMvwduor8hnLxQCx8iJ92wDGl2Mw,2053
|
|
12
|
-
telebot/types.py,sha256=
|
|
12
|
+
telebot/types.py,sha256=KiKe3WnBAGCN_65Uxe104IGG77cvpUthTzlEjwnc0r4,459391
|
|
13
13
|
telebot/util.py,sha256=ebHSB2ErYBF7um0OrEM2SWlNzPfJxPafLzSXmpLqg9Y,21480
|
|
14
|
-
telebot/version.py,sha256=
|
|
14
|
+
telebot/version.py,sha256=Tnvg8y4m-lo7AoVULJmGiBr07hzlCPtq0WcicZOKHU4,99
|
|
15
15
|
telebot/asyncio_storage/__init__.py,sha256=g2PQQF0shmBxL8APFRHUxDiKquRpFoDAZZrUcHc3T6k,425
|
|
16
16
|
telebot/asyncio_storage/base_storage.py,sha256=Dj00wiTqQIiQ_pjm8f8hoCR6-eOSgvvV5CldfUBV6Vg,1808
|
|
17
17
|
telebot/asyncio_storage/memory_storage.py,sha256=SiIkFMMUNg2_p5wJ2M3BPXn_i4V0JH-LVAqAov17S_E,2396
|
|
@@ -28,7 +28,7 @@ telebot/storage/base_storage.py,sha256=nZRL7iOVbi82phlCrnOu4nD1kIR_z093WvKm7r8mC
|
|
|
28
28
|
telebot/storage/memory_storage.py,sha256=7s3SMrVUZuyhEKE8TwCUL4m6a58U9793bU6Y1qI0i_U,2377
|
|
29
29
|
telebot/storage/pickle_storage.py,sha256=6Hb11Vi8POBFYqt1TIjdouZHWS9_1H6eAvTEAoMOvDs,4065
|
|
30
30
|
telebot/storage/redis_storage.py,sha256=8gQ9fc9mSOwkBx1DhJ3FjedWU8vSKVZs1o3KKd2cBkc,5776
|
|
31
|
-
pytelegrambotapi-4.
|
|
32
|
-
pytelegrambotapi-4.
|
|
33
|
-
pytelegrambotapi-4.
|
|
34
|
-
pytelegrambotapi-4.
|
|
31
|
+
pytelegrambotapi-4.22.0.dist-info/METADATA,sha256=V5zhbWFrQxSEmQX7CETYZweHL-A9Jd5ORTZ5SL2av-o,48131
|
|
32
|
+
pytelegrambotapi-4.22.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
|
|
33
|
+
pytelegrambotapi-4.22.0.dist-info/licenses/LICENSE,sha256=qz_jTTxi4zSAFaTdASiwml2iAk0UZ6R4MRADNzwYo_A,18387
|
|
34
|
+
pytelegrambotapi-4.22.0.dist-info/RECORD,,
|
telebot/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from telebot.storage import StatePickleStorage, StateMemoryStorage, StateStorage
|
|
|
20
20
|
# random module to generate random string
|
|
21
21
|
import random
|
|
22
22
|
import string
|
|
23
|
+
import copy
|
|
23
24
|
|
|
24
25
|
import ssl
|
|
25
26
|
|
|
@@ -4640,7 +4641,7 @@ class TeleBot:
|
|
|
4640
4641
|
|
|
4641
4642
|
def pin_chat_message(
|
|
4642
4643
|
self, chat_id: Union[int, str], message_id: int,
|
|
4643
|
-
disable_notification: Optional[bool]=False) -> bool:
|
|
4644
|
+
disable_notification: Optional[bool]=False, business_connection_id: Optional[str]=None) -> bool:
|
|
4644
4645
|
"""
|
|
4645
4646
|
Use this method to pin a message in a supergroup.
|
|
4646
4647
|
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -4659,15 +4660,19 @@ class TeleBot:
|
|
|
4659
4660
|
to all group members about the new pinned message
|
|
4660
4661
|
:type disable_notification: :obj:`bool`
|
|
4661
4662
|
|
|
4663
|
+
:param business_connection_id: Unique identifier of the business connection
|
|
4664
|
+
:type business_connection_id: :obj:`str`
|
|
4665
|
+
|
|
4662
4666
|
:return: True on success.
|
|
4663
4667
|
:rtype: :obj:`bool`
|
|
4664
4668
|
"""
|
|
4665
4669
|
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
|
|
4666
4670
|
|
|
4667
|
-
return apihelper.pin_chat_message(self.token, chat_id, message_id, disable_notification=disable_notification
|
|
4671
|
+
return apihelper.pin_chat_message(self.token, chat_id, message_id, disable_notification=disable_notification,
|
|
4672
|
+
business_connection_id=business_connection_id)
|
|
4668
4673
|
|
|
4669
4674
|
|
|
4670
|
-
def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None) -> bool:
|
|
4675
|
+
def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None, business_connection_id: Optional[str]=None) -> bool:
|
|
4671
4676
|
"""
|
|
4672
4677
|
Use this method to unpin specific pinned message in a supergroup chat.
|
|
4673
4678
|
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -4682,10 +4687,13 @@ class TeleBot:
|
|
|
4682
4687
|
:param message_id: Int: Identifier of a message to unpin
|
|
4683
4688
|
:type message_id: :obj:`int`
|
|
4684
4689
|
|
|
4690
|
+
:param business_connection_id: Unique identifier of the business connection
|
|
4691
|
+
:type business_connection_id: :obj:`str`
|
|
4692
|
+
|
|
4685
4693
|
:return: True on success.
|
|
4686
4694
|
:rtype: :obj:`bool`
|
|
4687
4695
|
"""
|
|
4688
|
-
return apihelper.unpin_chat_message(self.token, chat_id, message_id)
|
|
4696
|
+
return apihelper.unpin_chat_message(self.token, chat_id, message_id, business_connection_id=business_connection_id)
|
|
4689
4697
|
|
|
4690
4698
|
|
|
4691
4699
|
def unpin_all_chat_messages(self, chat_id: Union[int, str]) -> bool:
|
|
@@ -7700,7 +7708,7 @@ class TeleBot:
|
|
|
7700
7708
|
self.add_chosen_inline_handler(handler_dict)
|
|
7701
7709
|
|
|
7702
7710
|
|
|
7703
|
-
def callback_query_handler(self, func, **kwargs):
|
|
7711
|
+
def callback_query_handler(self, func=None, **kwargs):
|
|
7704
7712
|
"""
|
|
7705
7713
|
Handles new incoming callback query.
|
|
7706
7714
|
As a parameter to the decorator function, it passes :class:`telebot.types.CallbackQuery` object.
|
|
@@ -8749,7 +8757,7 @@ class TeleBot:
|
|
|
8749
8757
|
logger.error("It is not allowed to pass data and values inside data to the handler. Check your handler: {}".format(handler['function']))
|
|
8750
8758
|
return
|
|
8751
8759
|
else:
|
|
8752
|
-
data_copy =
|
|
8760
|
+
data_copy = copy.deepcopy(data)
|
|
8753
8761
|
for key in list(data_copy):
|
|
8754
8762
|
# remove data from data_copy if handler does not accept it
|
|
8755
8763
|
if key not in params:
|
telebot/apihelper.py
CHANGED
|
@@ -1386,19 +1386,23 @@ def set_chat_description(token, chat_id, description):
|
|
|
1386
1386
|
return _make_request(token, method_url, params=payload, method='post')
|
|
1387
1387
|
|
|
1388
1388
|
|
|
1389
|
-
def pin_chat_message(token, chat_id, message_id, disable_notification=None):
|
|
1389
|
+
def pin_chat_message(token, chat_id, message_id, disable_notification=None, business_connection_id=None):
|
|
1390
1390
|
method_url = 'pinChatMessage'
|
|
1391
1391
|
payload = {'chat_id': chat_id, 'message_id': message_id}
|
|
1392
1392
|
if disable_notification is not None:
|
|
1393
1393
|
payload['disable_notification'] = disable_notification
|
|
1394
|
+
if business_connection_id:
|
|
1395
|
+
payload['business_connection_id'] = business_connection_id
|
|
1394
1396
|
return _make_request(token, method_url, params=payload, method='post')
|
|
1395
1397
|
|
|
1396
1398
|
|
|
1397
|
-
def unpin_chat_message(token, chat_id, message_id):
|
|
1399
|
+
def unpin_chat_message(token, chat_id, message_id, business_connection_id=None):
|
|
1398
1400
|
method_url = 'unpinChatMessage'
|
|
1399
1401
|
payload = {'chat_id': chat_id}
|
|
1400
1402
|
if message_id:
|
|
1401
1403
|
payload['message_id'] = message_id
|
|
1404
|
+
if business_connection_id:
|
|
1405
|
+
payload['business_connection_id'] = business_connection_id
|
|
1402
1406
|
return _make_request(token, method_url, params=payload, method='post')
|
|
1403
1407
|
|
|
1404
1408
|
|
telebot/async_telebot.py
CHANGED
|
@@ -32,7 +32,7 @@ REPLY_MARKUP_TYPES = Union[
|
|
|
32
32
|
import string
|
|
33
33
|
import random
|
|
34
34
|
import ssl
|
|
35
|
-
|
|
35
|
+
import copy
|
|
36
36
|
|
|
37
37
|
"""
|
|
38
38
|
Module : telebot
|
|
@@ -558,7 +558,7 @@ class AsyncTeleBot:
|
|
|
558
558
|
logger.error("It is not allowed to pass data and values inside data to the handler. Check your handler: {}".format(handler['function']))
|
|
559
559
|
return
|
|
560
560
|
else:
|
|
561
|
-
data_copy =
|
|
561
|
+
data_copy = copy.deepcopy(data)
|
|
562
562
|
for key in list(data_copy):
|
|
563
563
|
# remove data from data_copy if handler does not accept it
|
|
564
564
|
if key not in params:
|
|
@@ -1700,7 +1700,7 @@ class AsyncTeleBot:
|
|
|
1700
1700
|
handler_dict = self._build_handler_dict(callback, func=func, pass_bot=pass_bot, **kwargs)
|
|
1701
1701
|
self.add_chosen_inline_handler(handler_dict)
|
|
1702
1702
|
|
|
1703
|
-
def callback_query_handler(self, func, **kwargs):
|
|
1703
|
+
def callback_query_handler(self, func=None, **kwargs):
|
|
1704
1704
|
"""
|
|
1705
1705
|
Handles new incoming callback query.
|
|
1706
1706
|
As a parameter to the decorator function, it passes :class:`telebot.types.CallbackQuery` object.
|
|
@@ -6023,7 +6023,7 @@ class AsyncTeleBot:
|
|
|
6023
6023
|
|
|
6024
6024
|
async def pin_chat_message(
|
|
6025
6025
|
self, chat_id: Union[int, str], message_id: int,
|
|
6026
|
-
disable_notification: Optional[bool]=False) -> bool:
|
|
6026
|
+
disable_notification: Optional[bool]=False, business_connection_id: Optional[str]=None) -> bool:
|
|
6027
6027
|
"""
|
|
6028
6028
|
Use this method to pin a message in a supergroup.
|
|
6029
6029
|
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -6042,14 +6042,17 @@ class AsyncTeleBot:
|
|
|
6042
6042
|
to all group members about the new pinned message
|
|
6043
6043
|
:type disable_notification: :obj:`bool`
|
|
6044
6044
|
|
|
6045
|
+
:param business_connection_id: Unique identifier of the business connection
|
|
6046
|
+
:type business_connection_id: :obj:`str`
|
|
6047
|
+
|
|
6045
6048
|
:return: True on success.
|
|
6046
6049
|
:rtype: :obj:`bool`
|
|
6047
6050
|
"""
|
|
6048
6051
|
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
|
|
6049
6052
|
|
|
6050
|
-
return await asyncio_helper.pin_chat_message(self.token, chat_id, message_id, disable_notification)
|
|
6053
|
+
return await asyncio_helper.pin_chat_message(self.token, chat_id, message_id, disable_notification, business_connection_id)
|
|
6051
6054
|
|
|
6052
|
-
async def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None) -> bool:
|
|
6055
|
+
async def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None, business_connection_id: Optional[str]=None) -> bool:
|
|
6053
6056
|
"""
|
|
6054
6057
|
Use this method to unpin specific pinned message in a supergroup chat.
|
|
6055
6058
|
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
|
@@ -6064,10 +6067,13 @@ class AsyncTeleBot:
|
|
|
6064
6067
|
:param message_id: Int: Identifier of a message to unpin
|
|
6065
6068
|
:type message_id: :obj:`int`
|
|
6066
6069
|
|
|
6070
|
+
:param business_connection_id: Unique identifier of the business connection
|
|
6071
|
+
:type business_connection_id: :obj:`str`
|
|
6072
|
+
|
|
6067
6073
|
:return: True on success.
|
|
6068
6074
|
:rtype: :obj:`bool`
|
|
6069
6075
|
"""
|
|
6070
|
-
return await asyncio_helper.unpin_chat_message(self.token, chat_id, message_id)
|
|
6076
|
+
return await asyncio_helper.unpin_chat_message(self.token, chat_id, message_id, business_connection_id)
|
|
6071
6077
|
|
|
6072
6078
|
async def unpin_all_chat_messages(self, chat_id: Union[int, str]) -> bool:
|
|
6073
6079
|
"""
|