From 7b852206f1023fbc90867772ab6cda6b388f952e Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Sat, 4 Jul 2020 12:30:15 +0200 Subject: [PATCH] Fix click timeout error is now different --- telethon/tl/custom/message.py | 2 +- telethon/tl/custom/messagebutton.py | 6 +++--- telethon_generator/data/errors.csv | 1 + telethon_generator/data/methods.csv | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 4ece30d8..56f4c725 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -844,7 +844,7 @@ class Message(ChatGetter, SenderGetter, TLObject, abc.ABC): data=data ) ) - except errors.BotTimeout: + except errors.BotResponseTimeoutError: return None if sum(int(x is not None) for x in (i, text, filter)) >= 2: diff --git a/telethon/tl/custom/messagebutton.py b/telethon/tl/custom/messagebutton.py index 5c749ac3..2bd0a68d 100644 --- a/telethon/tl/custom/messagebutton.py +++ b/telethon/tl/custom/messagebutton.py @@ -1,5 +1,5 @@ from .. import types, functions -from ...errors import BotTimeout +from ...errors import BotResponseTimeoutError import webbrowser @@ -85,7 +85,7 @@ class MessageButton: ) try: return await self._client(req) - except BotTimeout: + except BotResponseTimeoutError: return None elif isinstance(self.button, types.KeyboardButtonSwitchInline): return await self._client(functions.messages.StartBotRequest( @@ -99,5 +99,5 @@ class MessageButton: ) try: return await self._client(req) - except BotTimeout: + except BotResponseTimeoutError: return None diff --git a/telethon_generator/data/errors.csv b/telethon_generator/data/errors.csv index e93dced3..94f98d95 100644 --- a/telethon_generator/data/errors.csv +++ b/telethon_generator/data/errors.csv @@ -29,6 +29,7 @@ BOT_METHOD_INVALID,400,The API access for bot users is restricted. The method yo BOT_MISSING,400,This method can only be run by a bot BOT_PAYMENTS_DISABLED,400,This method can only be run by a bot BOT_POLLS_DISABLED,400,You cannot create polls under a bot account +BOT_RESPONSE_TIMEOUT,400,The bot did not answer to the callback query in time BROADCAST_ID_INVALID,400,The channel is invalid BROADCAST_PUBLIC_VOTERS_FORBIDDEN,400,You cannot broadcast polls where the voters are public BUTTON_DATA_INVALID,400,The provided button data is invalid diff --git a/telethon_generator/data/methods.csv b/telethon_generator/data/methods.csv index 20e50aae..16a95026 100644 --- a/telethon_generator/data/methods.csv +++ b/telethon_generator/data/methods.csv @@ -199,7 +199,7 @@ messages.getAllDrafts,user, messages.getAllStickers,user, messages.getArchivedStickers,user, messages.getAttachedStickers,user, -messages.getBotCallbackAnswer,user,CHANNEL_INVALID DATA_INVALID MESSAGE_ID_INVALID PEER_ID_INVALID Timeout +messages.getBotCallbackAnswer,user,BOT_RESPONSE_TIMEOUT CHANNEL_INVALID DATA_INVALID MESSAGE_ID_INVALID PEER_ID_INVALID Timeout messages.getChats,both,CHAT_ID_INVALID PEER_ID_INVALID messages.getCommonChats,user,USER_ID_INVALID messages.getDhConfig,user,RANDOM_LENGTH_INVALID