pyTelegramBotAPI 4.19.2__py3-none-any.whl → 4.21.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyTelegramBotAPI
3
- Version: 4.19.2
3
+ Version: 4.21.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-changelog#may-28-2024">7.4</a>!
58
+ ## <p align="center">Supported Bot API version: <a href="https://core.telegram.org/bots/api#july-7-2024">7.6</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>
@@ -0,0 +1,34 @@
1
+ telebot/__init__.py,sha256=e3OQB64mJ52AR-Qy9g20Pyg628s5JdSiMOPakDoOudM,406344
2
+ telebot/apihelper.py,sha256=jzoQjtdQ0-0Ultnim5ZjAInkbI-OSuRY25fVLXmSpQo,94032
3
+ telebot/async_telebot.py,sha256=XSdL9MS5640-5hc4gYTK4X7TyXGoukPElnZQwNytu0Y,379665
4
+ telebot/asyncio_filters.py,sha256=R3h4_ErjZLqzM3wG3-D7peihtnV2DzRGOqHxPrXE6H4,13466
5
+ telebot/asyncio_handler_backends.py,sha256=IujW69w8sQ8Kc2gogppiTWi2DgQ7kcmCjbgPXNTnO7U,3893
6
+ telebot/asyncio_helper.py,sha256=4dj5eSBg4S7KU9TEtmS8Im6LWMapDJuFbOprEt6_yUY,94795
7
+ telebot/callback_data.py,sha256=k4Rz3lAONG5J2M9TESKMIjqXoBNJMfEy9nnrmJAyi3Q,5358
8
+ telebot/custom_filters.py,sha256=biuxaoRfgKR8dx5Ev0UhlGxZSXOFuJsiw1VGz7f6Fcs,13172
9
+ telebot/formatting.py,sha256=BTcZ7fzOEmIxUgQxdhhG9zDyDFcNWN2NevOV9P7Puho,15210
10
+ telebot/handler_backends.py,sha256=fW0vAo4luo99e4hWMktuow55_G1o6UUiBlU5kY08aKY,9210
11
+ telebot/service_utils.py,sha256=xLmlZLTVs34UOdQtMvwduor8hnLxQCx8iJ92wDGl2Mw,2053
12
+ telebot/types.py,sha256=23_d_1zpXHrAFvDiIpqAzv1y9rXQW4DpBr_c4KF3ZtQ,444991
13
+ telebot/util.py,sha256=ebHSB2ErYBF7um0OrEM2SWlNzPfJxPafLzSXmpLqg9Y,21480
14
+ telebot/version.py,sha256=R3a64xskASiLTEr6mhsdFLJ5KGkj_JBlC1EDhgAYui4,99
15
+ telebot/asyncio_storage/__init__.py,sha256=g2PQQF0shmBxL8APFRHUxDiKquRpFoDAZZrUcHc3T6k,425
16
+ telebot/asyncio_storage/base_storage.py,sha256=Dj00wiTqQIiQ_pjm8f8hoCR6-eOSgvvV5CldfUBV6Vg,1808
17
+ telebot/asyncio_storage/memory_storage.py,sha256=SiIkFMMUNg2_p5wJ2M3BPXn_i4V0JH-LVAqAov17S_E,2396
18
+ telebot/asyncio_storage/pickle_storage.py,sha256=i1O0pOBsmz4toK2UI5L7NrsDeEUNurpTrjHqUPc98b4,3895
19
+ telebot/asyncio_storage/redis_storage.py,sha256=fpWfrtxwm732mo78bGOVILEmV3_2CQrlXqNVFL2cSzY,6047
20
+ telebot/ext/__init__.py,sha256=_mSeNU1cib3cWSZ6Kb6nKy9znEYwEzGNRCYZsD61rLk,66
21
+ telebot/ext/reloader.py,sha256=vzmJxCsA_COHF-bpmyddDuUXroxNih051IYRMiR21LY,826
22
+ telebot/ext/aio/__init__.py,sha256=2yi7jtvEIH1DqAseFevfujNYi7ZSh5aPMOKGrxIgqsw,143
23
+ telebot/ext/aio/webhooks.py,sha256=tf4DMXkKWvM_Uko_lpLRc0uDwttyZGvsvDLNNbwmO_Y,3788
24
+ telebot/ext/sync/__init__.py,sha256=Lj-15dj1TYkf11d0vY14_2mssnoFR5Uk320huWa_rGc,140
25
+ telebot/ext/sync/webhooks.py,sha256=XMMhXnDuFs7CWJ7iDi11H0dwf6fRA4pbAjFjNgNJ18Y,3513
26
+ telebot/storage/__init__.py,sha256=CR2IO3YpYj1yKubxwPLrsjvwETv0y-N2Z2gxUfLvRsE,393
27
+ telebot/storage/base_storage.py,sha256=nZRL7iOVbi82phlCrnOu4nD1kIR_z093WvKm7r8mCXM,1784
28
+ telebot/storage/memory_storage.py,sha256=7s3SMrVUZuyhEKE8TwCUL4m6a58U9793bU6Y1qI0i_U,2377
29
+ telebot/storage/pickle_storage.py,sha256=6Hb11Vi8POBFYqt1TIjdouZHWS9_1H6eAvTEAoMOvDs,4065
30
+ telebot/storage/redis_storage.py,sha256=8gQ9fc9mSOwkBx1DhJ3FjedWU8vSKVZs1o3KKd2cBkc,5776
31
+ pytelegrambotapi-4.21.0.dist-info/METADATA,sha256=b_QzbKIJIHxRa7QjKCdVxOkJeZeyHjWSrY9Cx_u7Uwc,48120
32
+ pytelegrambotapi-4.21.0.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
33
+ pytelegrambotapi-4.21.0.dist-info/licenses/LICENSE,sha256=qz_jTTxi4zSAFaTdASiwml2iAk0UZ6R4MRADNzwYo_A,18387
34
+ pytelegrambotapi-4.21.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.24.2
2
+ Generator: hatchling 1.25.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
telebot/__init__.py CHANGED
@@ -1822,6 +1822,9 @@ class TeleBot:
1822
1822
  show_caption_above_media: Optional[bool]=None) -> types.MessageID:
1823
1823
  """
1824
1824
  Use this method to copy messages of any kind.
1825
+ Service messages, paid media messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
1826
+ A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method
1827
+ forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.
1825
1828
 
1826
1829
  Telegram documentation: https://core.telegram.org/bots/api#copymessage
1827
1830
 
@@ -1999,47 +2002,47 @@ class TeleBot:
1999
2002
  def copy_messages(self, chat_id: Union[str, int], from_chat_id: Union[str, int], message_ids: List[int],
2000
2003
  disable_notification: Optional[bool] = None, message_thread_id: Optional[int] = None,
2001
2004
  protect_content: Optional[bool] = None, remove_caption: Optional[bool] = None) -> List[types.MessageID]:
2002
- """
2003
- Use this method to copy messages of any kind. If some of the specified messages can't be found or copied, they are skipped.
2004
- Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
2005
- A quiz poll can be copied only if the value of the field correct_option_id is known to the bot.
2006
- The method is analogous to the method forwardMessages, but the copied messages don't have a link to the original message.
2007
- Album grouping is kept for copied messages. On success, an array of MessageId of the sent messages is returned.
2005
+ """
2006
+ Use this method to copy messages of any kind.
2007
+ If some of the specified messages can't be found or copied, they are skipped. Service messages, paid media messages, giveaway messages, giveaway winners messages,
2008
+ and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous
2009
+ to the method forwardMessages, but the copied messages don't have a link to the original message. Album grouping is kept for copied messages. On success, an array
2010
+ of MessageId of the sent messages is returned.
2008
2011
 
2009
- Telegram documentation: https://core.telegram.org/bots/api#copymessages
2012
+ Telegram documentation: https://core.telegram.org/bots/api#copymessages
2010
2013
 
2011
2014
 
2012
- :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2013
- :type chat_id: :obj:`int` or :obj:`str`
2015
+ :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
2016
+ :type chat_id: :obj:`int` or :obj:`str`
2014
2017
 
2015
- :param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
2016
- :type from_chat_id: :obj:`int` or :obj:`str`
2018
+ :param from_chat_id: Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
2019
+ :type from_chat_id: :obj:`int` or :obj:`str`
2017
2020
 
2018
- :param message_ids: Message identifiers in the chat specified in from_chat_id
2019
- :type message_ids: :obj:`list` of :obj:`int`
2021
+ :param message_ids: Message identifiers in the chat specified in from_chat_id
2022
+ :type message_ids: :obj:`list` of :obj:`int`
2020
2023
 
2021
- :param disable_notification: Sends the message silently. Users will receive a notification with no sound
2022
- :type disable_notification: :obj:`bool`
2024
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound
2025
+ :type disable_notification: :obj:`bool`
2023
2026
 
2024
- :param message_thread_id: Identifier of a message thread, in which the messages will be sent
2025
- :type message_thread_id: :obj:`int`
2027
+ :param message_thread_id: Identifier of a message thread, in which the messages will be sent
2028
+ :type message_thread_id: :obj:`int`
2026
2029
 
2027
- :param protect_content: Protects the contents of the forwarded message from forwarding and saving
2028
- :type protect_content: :obj:`bool`
2030
+ :param protect_content: Protects the contents of the forwarded message from forwarding and saving
2031
+ :type protect_content: :obj:`bool`
2029
2032
 
2030
- :param remove_caption: Pass True to copy the messages without their captions
2031
- :type remove_caption: :obj:`bool`
2033
+ :param remove_caption: Pass True to copy the messages without their captions
2034
+ :type remove_caption: :obj:`bool`
2032
2035
 
2033
- :return: On success, an array of MessageId of the sent messages is returned.
2034
- :rtype: :obj:`list` of :class:`telebot.types.MessageID`
2035
- """
2036
- disable_notification = self.disable_notification if disable_notification is None else disable_notification
2037
- protect_content = self.protect_content if protect_content is None else protect_content
2036
+ :return: On success, an array of MessageId of the sent messages is returned.
2037
+ :rtype: :obj:`list` of :class:`telebot.types.MessageID`
2038
+ """
2039
+ disable_notification = self.disable_notification if disable_notification is None else disable_notification
2040
+ protect_content = self.protect_content if protect_content is None else protect_content
2038
2041
 
2039
- result = apihelper.copy_messages(
2040
- self.token, chat_id, from_chat_id, message_ids, disable_notification=disable_notification,
2041
- message_thread_id=message_thread_id, protect_content=protect_content, remove_caption=remove_caption)
2042
- return [types.MessageID.de_json(message_id) for message_id in result]
2042
+ result = apihelper.copy_messages(
2043
+ self.token, chat_id, from_chat_id, message_ids, disable_notification=disable_notification,
2044
+ message_thread_id=message_thread_id, protect_content=protect_content, remove_caption=remove_caption)
2045
+ return [types.MessageID.de_json(message_id) for message_id in result]
2043
2046
 
2044
2047
 
2045
2048
  def send_dice(
@@ -2598,6 +2601,10 @@ class TeleBot:
2598
2601
  logger.warning('The parameter "thumb" is deprecated. Use "thumbnail" instead.')
2599
2602
  thumbnail = thumb
2600
2603
 
2604
+ if isinstance(document, types.InputFile) and visible_file_name:
2605
+ # inputfile name ignored, warn
2606
+ logger.warning('Cannot use both InputFile and visible_file_name. InputFile name will be ignored.')
2607
+
2601
2608
  return types.Message.de_json(
2602
2609
  apihelper.send_data(
2603
2610
  self.token, chat_id, document, 'document',
@@ -3112,6 +3119,61 @@ class TeleBot:
3112
3119
  protect_content=protect_content, message_thread_id=message_thread_id, reply_parameters=reply_parameters,
3113
3120
  business_connection_id=business_connection_id, message_effect_id=message_effect_id)
3114
3121
  )
3122
+
3123
+ def send_paid_media(
3124
+ self, chat_id: Union[int, str], star_count: int, media: List[types.InputPaidMedia],
3125
+ caption: Optional[str]=None, parse_mode: Optional[str]=None, caption_entities: Optional[List[types.MessageEntity]]=None,
3126
+ show_caption_above_media: Optional[bool]=None, disable_notification: Optional[bool]=None,
3127
+ protect_content: Optional[bool]=None, reply_parameters: Optional[types.ReplyParameters]=None,
3128
+ reply_markup: Optional[REPLY_MARKUP_TYPES]=None) -> types.Message:
3129
+ """
3130
+ Use this method to send paid media to channel chats. On success, the sent Message is returned.
3131
+
3132
+ Telegram documentation: https://core.telegram.org/bots/api#sendpaidmedia
3133
+
3134
+ :param chat_id: Unique identifier for the target chat or username of the target channel (in the format @channelusername)
3135
+ :type chat_id: :obj:`int` or :obj:`str`
3136
+
3137
+ :param star_count: The number of Telegram Stars that must be paid to buy access to the media
3138
+ :type star_count: :obj:`int`
3139
+
3140
+ :param media: A JSON-serialized array describing the media to be sent; up to 10 items
3141
+ :type media: :obj:`list` of :class:`telebot.types.InputPaidMedia`
3142
+
3143
+ :param caption: Media caption, 0-1024 characters after entities parsing
3144
+ :type caption: :obj:`str`
3145
+
3146
+ :param parse_mode: Mode for parsing entities in the media caption
3147
+ :type parse_mode: :obj:`str`
3148
+
3149
+ :param caption_entities: List of special entities that appear in the caption, which can be specified instead of parse_mode
3150
+ :type caption_entities: :obj:`list` of :class:`telebot.types.MessageEntity`
3151
+
3152
+ :param show_caption_above_media: Pass True, if the caption must be shown above the message media
3153
+ :type show_caption_above_media: :obj:`bool`
3154
+
3155
+ :param disable_notification: Sends the message silently. Users will receive a notification with no sound.
3156
+ :type disable_notification: :obj:`bool`
3157
+
3158
+ :param protect_content: Protects the contents of the sent message from forwarding and saving
3159
+ :type protect_content: :obj:`bool`
3160
+
3161
+ :param reply_parameters: Description of the message to reply to
3162
+ :type reply_parameters: :class:`telebot.types.ReplyParameters`
3163
+
3164
+ :param reply_markup: Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove a reply keyboard or to force a reply from the user
3165
+ :type reply_markup: :class:`telebot.types.InlineKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardMarkup` or :class:`telebot.types.ReplyKeyboardRemove` or :class:`telebot.types.ForceReply`
3166
+
3167
+ :return: On success, the sent Message is returned.
3168
+ :rtype: :class:`telebot.types.Message`
3169
+ """
3170
+ return types.Message.de_json(
3171
+ apihelper.send_paid_media(
3172
+ self.token, chat_id, star_count, media, caption=caption, parse_mode=parse_mode,
3173
+ caption_entities=caption_entities, show_caption_above_media=show_caption_above_media,
3174
+ disable_notification=disable_notification, protect_content=protect_content,
3175
+ reply_parameters=reply_parameters, reply_markup=reply_markup)
3176
+ )
3115
3177
 
3116
3178
 
3117
3179
  def send_media_group(
@@ -3324,6 +3386,7 @@ class TeleBot:
3324
3386
  heading: Optional[int]=None,
3325
3387
  proximity_alert_radius: Optional[int]=None,
3326
3388
  live_period: Optional[int]=None,
3389
+ business_connection_id: Optional[str]=None
3327
3390
  ) -> types.Message or bool:
3328
3391
  """
3329
3392
  Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly
@@ -3366,6 +3429,9 @@ class TeleBot:
3366
3429
  :param live_period: New period in seconds during which the location can be updated, starting from the message send date. If 0x7FFFFFFF is specified, then the location can be updated forever. Otherwise, the new value must not exceed the current live_period by more than a day, and the live location expiration date must remain within the next 90 days. If not specified, then live_period remains unchanged
3367
3430
  :type live_period: :obj:`int`
3368
3431
 
3432
+ :param business_connection_id: Identifier of a business connection
3433
+ :type business_connection_id: :obj:`str`
3434
+
3369
3435
  :return: On success, if the edited message is not an inline message, the edited Message is returned, otherwise True is returned.
3370
3436
  :rtype: :class:`telebot.types.Message` or bool
3371
3437
  """
@@ -3373,7 +3439,7 @@ class TeleBot:
3373
3439
  apihelper.edit_message_live_location(
3374
3440
  self.token, latitude, longitude, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
3375
3441
  reply_markup=reply_markup, timeout=timeout, horizontal_accuracy=horizontal_accuracy, heading=heading,
3376
- proximity_alert_radius=proximity_alert_radius, live_period=live_period)
3442
+ proximity_alert_radius=proximity_alert_radius, live_period=live_period, business_connection_id=business_connection_id)
3377
3443
  )
3378
3444
 
3379
3445
 
@@ -3382,7 +3448,8 @@ class TeleBot:
3382
3448
  message_id: Optional[int]=None,
3383
3449
  inline_message_id: Optional[str]=None,
3384
3450
  reply_markup: Optional[types.InlineKeyboardMarkup]=None,
3385
- timeout: Optional[int]=None) -> types.Message or bool:
3451
+ timeout: Optional[int]=None,
3452
+ business_connection_id: Optional[str]=None) -> types.Message or bool:
3386
3453
  """
3387
3454
  Use this method to stop updating a live location message before live_period expires.
3388
3455
  On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
@@ -3405,13 +3472,16 @@ class TeleBot:
3405
3472
  :param timeout: Timeout in seconds for the request.
3406
3473
  :type timeout: :obj:`int`
3407
3474
 
3475
+ :param business_connection_id: Identifier of a business connection
3476
+ :type business_connection_id: :obj:`str`
3477
+
3408
3478
  :return: On success, if the message is not an inline message, the edited Message is returned, otherwise True is returned.
3409
3479
  :rtype: :class:`telebot.types.Message` or bool
3410
3480
  """
3411
3481
  return types.Message.de_json(
3412
3482
  apihelper.stop_message_live_location(
3413
3483
  self.token, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
3414
- reply_markup=reply_markup, timeout=timeout)
3484
+ reply_markup=reply_markup, timeout=timeout, business_connection_id=business_connection_id)
3415
3485
  )
3416
3486
 
3417
3487
 
@@ -4645,7 +4715,9 @@ class TeleBot:
4645
4715
  entities: Optional[List[types.MessageEntity]]=None,
4646
4716
  disable_web_page_preview: Optional[bool]=None, # deprecated, for backward compatibility
4647
4717
  reply_markup: Optional[types.InlineKeyboardMarkup]=None,
4648
- link_preview_options : Optional[types.LinkPreviewOptions]=None) -> Union[types.Message, bool]:
4718
+ link_preview_options : Optional[types.LinkPreviewOptions]=None,
4719
+ business_connection_id: Optional[str]=None,
4720
+ timeout: Optional[int]=None) -> Union[types.Message, bool]:
4649
4721
  """
4650
4722
  Use this method to edit text and game messages.
4651
4723
 
@@ -4678,6 +4750,12 @@ class TeleBot:
4678
4750
  :param link_preview_options: A JSON-serialized object for options used to automatically generate previews for links.
4679
4751
  :type link_preview_options: :obj:`LinkPreviewOptions`
4680
4752
 
4753
+ :param business_connection_id: Unique identifier of the business connection
4754
+ :type business_connection_id: :obj:`str`
4755
+
4756
+ :param timeout: Timeout in seconds for the request.
4757
+ :type timeout: :obj:`int`
4758
+
4681
4759
  :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
4682
4760
  :rtype: :obj:`types.Message` or :obj:`bool`
4683
4761
  """
@@ -4704,9 +4782,10 @@ class TeleBot:
4704
4782
 
4705
4783
  result = apihelper.edit_message_text(
4706
4784
  self.token, text, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
4707
- parse_mode=parse_mode, entities=entities, reply_markup=reply_markup, link_preview_options=link_preview_options)
4785
+ parse_mode=parse_mode, entities=entities, reply_markup=reply_markup, link_preview_options=link_preview_options,
4786
+ business_connection_id=business_connection_id, timeout=timeout)
4708
4787
 
4709
- if type(result) == bool: # if edit inline message return is bool not Message.
4788
+ if isinstance(result, bool): # if edit inline message return is bool not Message.
4710
4789
  return result
4711
4790
  return types.Message.de_json(result)
4712
4791
 
@@ -4715,7 +4794,9 @@ class TeleBot:
4715
4794
  self, media: Any, chat_id: Optional[Union[int, str]]=None,
4716
4795
  message_id: Optional[int]=None,
4717
4796
  inline_message_id: Optional[str]=None,
4718
- reply_markup: Optional[types.InlineKeyboardMarkup]=None) -> Union[types.Message, bool]:
4797
+ reply_markup: Optional[types.InlineKeyboardMarkup]=None,
4798
+ business_connection_id: Optional[str]=None,
4799
+ timeout: Optional[int]=None) -> Union[types.Message, bool]:
4719
4800
  """
4720
4801
  Use this method to edit animation, audio, document, photo, or video messages.
4721
4802
  If a message is a part of a message album, then it can be edited only to a photo or a video.
@@ -4738,14 +4819,20 @@ class TeleBot:
4738
4819
  :param reply_markup: A JSON-serialized object for an inline keyboard.
4739
4820
  :type reply_markup: :obj:`telebot.types.InlineKeyboardMarkup` or :obj:`ReplyKeyboardMarkup` or :obj:`ReplyKeyboardRemove` or :obj:`ForceReply`
4740
4821
 
4822
+ :param business_connection_id: Unique identifier of the business connection
4823
+ :type business_connection_id: :obj:`str`
4824
+
4825
+ :param timeout: Timeout in seconds for the request.
4826
+ :type timeout: :obj:`int`
4827
+
4741
4828
  :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
4742
4829
  :rtype: :obj:`types.Message` or :obj:`bool`
4743
4830
  """
4744
4831
  result = apihelper.edit_message_media(
4745
4832
  self.token, media, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
4746
- reply_markup=reply_markup)
4833
+ reply_markup=reply_markup, business_connection_id=business_connection_id, timeout=timeout)
4747
4834
 
4748
- if type(result) == bool: # if edit inline message return is bool not Message.
4835
+ if isinstance(result, bool): # if edit inline message return is bool not Message.
4749
4836
  return result
4750
4837
  return types.Message.de_json(result)
4751
4838
 
@@ -4754,7 +4841,9 @@ class TeleBot:
4754
4841
  self, chat_id: Optional[Union[int, str]]=None,
4755
4842
  message_id: Optional[int]=None,
4756
4843
  inline_message_id: Optional[str]=None,
4757
- reply_markup: Optional[types.InlineKeyboardMarkup]=None) -> Union[types.Message, bool]:
4844
+ reply_markup: Optional[types.InlineKeyboardMarkup]=None,
4845
+ business_connection_id: Optional[str]=None,
4846
+ timeout: Optional[int]=None) -> Union[types.Message, bool]:
4758
4847
  """
4759
4848
  Use this method to edit only the reply markup of messages.
4760
4849
 
@@ -4772,14 +4861,20 @@ class TeleBot:
4772
4861
  :param reply_markup: A JSON-serialized object for an inline keyboard.
4773
4862
  :type reply_markup: :obj:`InlineKeyboardMarkup` or :obj:`ReplyKeyboardMarkup` or :obj:`ReplyKeyboardRemove` or :obj:`ForceReply`
4774
4863
 
4864
+ :param business_connection_id: Unique identifier of the business connection
4865
+ :type business_connection_id: :obj:`str`
4866
+
4867
+ :param timeout: Timeout in seconds for the request.
4868
+ :type timeout: :obj:`int`
4869
+
4775
4870
  :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
4776
4871
  :rtype: :obj:`types.Message` or :obj:`bool`
4777
4872
  """
4778
4873
  result = apihelper.edit_message_reply_markup(
4779
4874
  self.token, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
4780
- reply_markup=reply_markup)
4875
+ reply_markup=reply_markup, business_connection_id=business_connection_id, timeout=timeout)
4781
4876
 
4782
- if type(result) == bool:
4877
+ if isinstance(result, bool):
4783
4878
  return result
4784
4879
  return types.Message.de_json(result)
4785
4880
 
@@ -4913,7 +5008,7 @@ class TeleBot:
4913
5008
  self.token, user_id, score, force=force, disable_edit_message=disable_edit_message,
4914
5009
  chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id)
4915
5010
 
4916
- if type(result) == bool:
5011
+ if isinstance(result, bool):
4917
5012
  return result
4918
5013
  return types.Message.de_json(result)
4919
5014
 
@@ -5397,7 +5492,8 @@ class TeleBot:
5397
5492
 
5398
5493
  def stop_poll(
5399
5494
  self, chat_id: Union[int, str], message_id: int,
5400
- reply_markup: Optional[types.InlineKeyboardMarkup]=None) -> types.Poll:
5495
+ reply_markup: Optional[types.InlineKeyboardMarkup]=None,
5496
+ business_connection_id: Optional[str]=None) -> types.Poll:
5401
5497
  """
5402
5498
  Use this method to stop a poll which was sent by the bot. On success, the stopped Poll is returned.
5403
5499
 
@@ -5412,11 +5508,14 @@ class TeleBot:
5412
5508
  :param reply_markup: A JSON-serialized object for a new message markup.
5413
5509
  :type reply_markup: :obj:`InlineKeyboardMarkup`
5414
5510
 
5511
+ :param business_connection_id: Identifier of the business connection to use for the poll
5512
+ :type business_connection_id: :obj:`str`
5513
+
5415
5514
  :return: On success, the stopped Poll is returned.
5416
5515
  :rtype: :obj:`types.Poll`
5417
5516
  """
5418
5517
  return types.Poll.de_json(
5419
- apihelper.stop_poll(self.token, chat_id, message_id, reply_markup=reply_markup)
5518
+ apihelper.stop_poll(self.token, chat_id, message_id, reply_markup=reply_markup, business_connection_id=business_connection_id)
5420
5519
  )
5421
5520
 
5422
5521
 
@@ -5478,6 +5577,27 @@ class TeleBot:
5478
5577
  """
5479
5578
  return apihelper.answer_pre_checkout_query(
5480
5579
  self.token, pre_checkout_query_id, ok, error_message=error_message)
5580
+
5581
+
5582
+ def get_star_transactions(self, offset: Optional[int]=None, limit: Optional[int]=None) -> types.StarTransactions:
5583
+ """
5584
+ Returns the bot's Telegram Star transactions in chronological order. On success, returns a StarTransactions object.
5585
+
5586
+ Telegram documentation: https://core.telegram.org/bots/api#getstartransactions
5587
+
5588
+ :param offset: Number of transactions to skip in the response
5589
+ :type offset: :obj:`int`
5590
+
5591
+ :param limit: The maximum number of transactions to be retrieved. Values between 1-100 are accepted. Defaults to 100.
5592
+ :type limit: :obj:`int`
5593
+
5594
+ :return: On success, returns a StarTransactions object.
5595
+ :rtype: :obj:`types.StarTransactions`
5596
+ """
5597
+ return types.StarTransactions.de_json(
5598
+ apihelper.get_star_transactions(self.token, offset=offset, limit=limit)
5599
+ )
5600
+
5481
5601
 
5482
5602
  def refund_star_payment(self, user_id: int, telegram_payment_charge_id: str) -> bool:
5483
5603
  """
@@ -5503,7 +5623,9 @@ class TeleBot:
5503
5623
  parse_mode: Optional[str]=None,
5504
5624
  caption_entities: Optional[List[types.MessageEntity]]=None,
5505
5625
  reply_markup: Optional[types.InlineKeyboardMarkup]=None,
5506
- show_caption_above_media: Optional[bool]=None) -> Union[types.Message, bool]:
5626
+ show_caption_above_media: Optional[bool]=None,
5627
+ business_connection_id: Optional[str]=None,
5628
+ timeout: Optional[int]=None) -> Union[types.Message, bool]:
5507
5629
  """
5508
5630
  Use this method to edit captions of messages.
5509
5631
 
@@ -5533,6 +5655,12 @@ class TeleBot:
5533
5655
  :param show_caption_above_media: Pass True, if the caption must be shown above the message media. Supported only for animation, photo and video messages.
5534
5656
  :type show_caption_above_media: :obj:`bool`
5535
5657
 
5658
+ :param business_connection_id: Identifier of the business connection to use for the message
5659
+ :type business_connection_id: :obj:`str`
5660
+
5661
+ :param timeout: Timeout in seconds for the request.
5662
+ :type timeout: :obj:`int`
5663
+
5536
5664
  :return: On success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
5537
5665
  :rtype: :obj:`types.Message` | :obj:`bool`
5538
5666
  """
@@ -5541,9 +5669,10 @@ class TeleBot:
5541
5669
  result = apihelper.edit_message_caption(
5542
5670
  self.token, caption, chat_id=chat_id, message_id=message_id, inline_message_id=inline_message_id,
5543
5671
  parse_mode=parse_mode, caption_entities=caption_entities, reply_markup=reply_markup,
5544
- show_caption_above_media=show_caption_above_media)
5672
+ show_caption_above_media=show_caption_above_media, business_connection_id=business_connection_id,
5673
+ timeout=timeout)
5545
5674
 
5546
- if type(result) == bool:
5675
+ if isinstance(result, bool):
5547
5676
  return result
5548
5677
  return types.Message.de_json(result)
5549
5678
 
@@ -8269,6 +8398,7 @@ class TeleBot:
8269
8398
  regexp: Optional[str]=None,
8270
8399
  func: Optional[Callable]=None,
8271
8400
  content_types: Optional[List[str]]=None,
8401
+ pass_bot: Optional[bool]=False,
8272
8402
  **kwargs):
8273
8403
  """
8274
8404
  Registers business connection handler.
@@ -8288,11 +8418,15 @@ class TeleBot:
8288
8418
  :param content_types: Supported message content types. Must be a list. Defaults to ['text'].
8289
8419
  :type content_types: :obj:`list` of :obj:`str`
8290
8420
 
8421
+ :param pass_bot: True, if bot instance should be passed to handler
8422
+ :type pass_bot: :obj:`bool`
8423
+
8291
8424
  :param kwargs: Optional keyword arguments(custom filters)
8292
8425
 
8293
8426
  :return: None
8294
8427
  """
8295
- handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func, **kwargs)
8428
+ handler_dict = self._build_handler_dict(callback, content_types=content_types, commands=commands, regexp=regexp, func=func,
8429
+ pass_bot=pass_bot, **kwargs)
8296
8430
  self.add_business_message_handler(handler_dict)
8297
8431
 
8298
8432