Compliance with bot API 7.10
This commit is contained in:
parent
6759e5c704
commit
425902d2ac
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,6 +41,7 @@ __pycache__/
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
.venv/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user