diff --git a/.gitignore b/.gitignore index 517b896..08dcf21 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,7 @@ __pycache__/ # Distribution / packaging .Python env/ +.venv/ build/ develop-eggs/ dist/ diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 75920f7..f7c28c2 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -11,7 +11,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.10.7" +__version__ = "2.10.8" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/api.py b/davtelepot/api.py index 93e8845..b7c5c4d 100644 --- a/davtelepot/api.py +++ b/davtelepot/api.py @@ -3109,6 +3109,7 @@ class TelegramBot: async def sendPaidMedia(self, chat_id: Union[int, str], star_count: int, media: List[InputPaidMedia], + payload: str = None, business_connection_id: str = None, caption: str = None, parse_mode: str = None, caption_entities: List[dict] = None, diff --git a/davtelepot/bot.py b/davtelepot/bot.py index 7f1daa3..8a71910 100644 --- a/davtelepot/bot.py +++ b/davtelepot/bot.py @@ -122,12 +122,47 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): 'edited_message': self.edited_message_handler, 'channel_post': self.channel_post_handler, 'edited_channel_post': self.edited_channel_post_handler, + 'business_connection': self.get_update_handler( + update_type='business_connection' + ), + 'business_message': self.get_update_handler( + update_type='business_message' + ), + 'edited_business_message': self.get_update_handler( + update_type='edited_business_message' + ), + 'deleted_business_messages': self.get_update_handler( + update_type='deleted_business_messages' + ), + 'message_reaction': self.get_update_handler( + update_type='message_reaction' + ), + 'message_reaction_count': self.get_update_handler( + update_type='message_reaction_count' + ), 'inline_query': self.inline_query_handler, 'chosen_inline_result': self.chosen_inline_result_handler, 'callback_query': self.callback_query_handler, 'shipping_query': self.shipping_query_handler, 'pre_checkout_query': self.pre_checkout_query_handler, + 'purchased_paid_media': self.get_update_handler( + update_type='purchased_paid_media' + ), 'poll': self.poll_handler, + 'poll_answer': self.get_update_handler( + update_type='poll_answer' + ), + 'my_chat_member': self.get_update_handler( + update_type='my_chat_member' + ), + 'chat_member': self.get_update_handler( update_type='chat_member' ), + 'chat_join_request': self.get_update_handler( + update_type='chat_join_request' + ), + 'chat_boost': self.get_update_handler( update_type='chat_boost' ), + 'removed_chat_boost': self.get_update_handler( + update_type='removed_chat_boost' + ), } # Different message update types need different handlers self.message_handlers = { @@ -682,6 +717,18 @@ class Bot(TelegramBot, ObjectWithDatabase, MultiLanguageObject): ) return + def get_update_handler(self, update_type: str): + """Get update handler for `update_type`.""" + bot = self + async def handler(update, user_record, language=None): + """Handle update message of type `update_type`""" + logging.info( + "The following update was received: %s\n" + "However, this `%s` handler does nothing yet.", + update, update_type + ) + return handler + async def edited_channel_post_handler(self, update, user_record, language=None): """Handle Telegram `edited_channel_post` update.""" logging.info(