Skip to content

Commit cf6c4cc

Browse files
authored
Merge branch 'eternnoir:master' into master
2 parents 5c0ca18 + 5f9b5c7 commit cf6c4cc

File tree

9 files changed

+707
-605
lines changed

9 files changed

+707
-605
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<p align="center">A simple, but extensible Python implementation for the <a href="https://core.telegram.org/bots/api">Telegram Bot API</a>.</p>
1111
<p align="center">Both synchronous and asynchronous.</p>
1212

13-
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#july-7-2024">7.7</a>!
13+
## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api-changelog#july-31-2024">7.8</a>!
1414

1515
<h2><a href='https://pytba.readthedocs.io/en/latest/index.html'>Official documentation</a></h2>
1616
<h2><a href='https://pytba.readthedocs.io/ru/latest/index.html'>Official ru documentation</a></h2>

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
copyright = f'2022-{datetime.now().year}, {author}'
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = '4.21.0'
25+
release = '4.22.0'
2626

2727

2828
# -- General configuration ---------------------------------------------------

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "pyTelegramBotAPI"
7-
version = "4.21.0"
7+
version = "4.22.0"
88
description = "Python Telegram bot api."
99
authors = [{name = "eternnoir", email = "eternnoir@gmail.com"}]
1010
license = {text = "GPL2"}

telebot/__init__.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4640,7 +4640,7 @@ def set_chat_description(self, chat_id: Union[int, str], description: Optional[s
46404640

46414641
def pin_chat_message(
46424642
self, chat_id: Union[int, str], message_id: int,
4643-
disable_notification: Optional[bool]=False) -> bool:
4643+
disable_notification: Optional[bool]=False, business_connection_id: Optional[str]=None) -> bool:
46444644
"""
46454645
Use this method to pin a message in a supergroup.
46464646
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
@@ -4659,15 +4659,19 @@ def pin_chat_message(
46594659
to all group members about the new pinned message
46604660
:type disable_notification: :obj:`bool`
46614661
4662+
:param business_connection_id: Unique identifier of the business connection
4663+
:type business_connection_id: :obj:`str`
4664+
46624665
:return: True on success.
46634666
:rtype: :obj:`bool`
46644667
"""
46654668
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
46664669

4667-
return apihelper.pin_chat_message(self.token, chat_id, message_id, disable_notification=disable_notification)
4670+
return apihelper.pin_chat_message(self.token, chat_id, message_id, disable_notification=disable_notification,
4671+
business_connection_id=business_connection_id)
46684672

46694673

4670-
def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None) -> bool:
4674+
def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]=None, business_connection_id: Optional[str]=None) -> bool:
46714675
"""
46724676
Use this method to unpin specific pinned message in a supergroup chat.
46734677
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
@@ -4682,10 +4686,13 @@ def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optional[int]
46824686
:param message_id: Int: Identifier of a message to unpin
46834687
:type message_id: :obj:`int`
46844688
4689+
:param business_connection_id: Unique identifier of the business connection
4690+
:type business_connection_id: :obj:`str`
4691+
46854692
:return: True on success.
46864693
:rtype: :obj:`bool`
46874694
"""
4688-
return apihelper.unpin_chat_message(self.token, chat_id, message_id)
4695+
return apihelper.unpin_chat_message(self.token, chat_id, message_id, business_connection_id=business_connection_id)
46894696

46904697

46914698
def unpin_all_chat_messages(self, chat_id: Union[int, str]) -> bool:

telebot/apihelper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,19 +1386,23 @@ def set_chat_description(token, chat_id, description):
13861386
return _make_request(token, method_url, params=payload, method='post')
13871387

13881388

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):
13901390
method_url = 'pinChatMessage'
13911391
payload = {'chat_id': chat_id, 'message_id': message_id}
13921392
if disable_notification is not None:
13931393
payload['disable_notification'] = disable_notification
1394+
if business_connection_id:
1395+
payload['business_connection_id'] = business_connection_id
13941396
return _make_request(token, method_url, params=payload, method='post')
13951397

13961398

1397-
def unpin_chat_message(token, chat_id, message_id):
1399+
def unpin_chat_message(token, chat_id, message_id, business_connection_id=None):
13981400
method_url = 'unpinChatMessage'
13991401
payload = {'chat_id': chat_id}
14001402
if message_id:
14011403
payload['message_id'] = message_id
1404+
if business_connection_id:
1405+
payload['business_connection_id'] = business_connection_id
14021406
return _make_request(token, method_url, params=payload, method='post')
14031407

14041408

telebot/async_telebot.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6023,7 +6023,7 @@ async def set_chat_description(self, chat_id: Union[int, str], description: Opti
60236023

60246024
async def pin_chat_message(
60256025
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:
60276027
"""
60286028
Use this method to pin a message in a supergroup.
60296029
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
@@ -6042,14 +6042,17 @@ async def pin_chat_message(
60426042
to all group members about the new pinned message
60436043
:type disable_notification: :obj:`bool`
60446044
6045+
:param business_connection_id: Unique identifier of the business connection
6046+
:type business_connection_id: :obj:`str`
6047+
60456048
:return: True on success.
60466049
:rtype: :obj:`bool`
60476050
"""
60486051
disable_notification = self.disable_notification if (disable_notification is None) else disable_notification
60496052

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)
60516054

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:
60536056
"""
60546057
Use this method to unpin specific pinned message in a supergroup chat.
60556058
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
@@ -6064,10 +6067,13 @@ async def unpin_chat_message(self, chat_id: Union[int, str], message_id: Optiona
60646067
:param message_id: Int: Identifier of a message to unpin
60656068
:type message_id: :obj:`int`
60666069
6070+
:param business_connection_id: Unique identifier of the business connection
6071+
:type business_connection_id: :obj:`str`
6072+
60676073
:return: True on success.
60686074
:rtype: :obj:`bool`
60696075
"""
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)
60716077

60726078
async def unpin_all_chat_messages(self, chat_id: Union[int, str]) -> bool:
60736079
"""

telebot/asyncio_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,19 +1365,23 @@ async def set_chat_description(token, chat_id, description):
13651365
return await _process_request(token, method_url, params=payload, method='post')
13661366

13671367

1368-
async def pin_chat_message(token, chat_id, message_id, disable_notification=None):
1368+
async def pin_chat_message(token, chat_id, message_id, disable_notification=None, business_connection_id=None):
13691369
method_url = 'pinChatMessage'
13701370
payload = {'chat_id': chat_id, 'message_id': message_id}
13711371
if disable_notification is not None:
13721372
payload['disable_notification'] = disable_notification
1373+
if business_connection_id:
1374+
payload['business_connection_id'] = business_connection_id
13731375
return await _process_request(token, method_url, params=payload, method='post')
13741376

13751377

1376-
async def unpin_chat_message(token, chat_id, message_id):
1378+
async def unpin_chat_message(token, chat_id, message_id, business_connection_id=None):
13771379
method_url = 'unpinChatMessage'
13781380
payload = {'chat_id': chat_id}
13791381
if message_id:
13801382
payload['message_id'] = message_id
1383+
if business_connection_id:
1384+
payload['business_connection_id'] = business_connection_id
13811385
return await _process_request(token, method_url, params=payload, method='post')
13821386

13831387

0 commit comments

Comments
 (0)