mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 12:53:44 +03:00
add exception
when pressing !h, sometimes TimeoutError and/or some other errors occurs due to network problems. The exception prevents the script from interruption and restarts the cycle, and allows to repeat the request without reloading the script.
This commit is contained in:
parent
27728be242
commit
aa5779b89a
|
@ -158,8 +158,11 @@ class InteractiveTelegramClient(TelegramClient):
|
|||
# History
|
||||
elif msg == '!h':
|
||||
# First retrieve the messages and some information
|
||||
total_count, messages, senders = self.get_message_history(
|
||||
try:
|
||||
total_count, messages, senders = self.get_message_history(
|
||||
entity, limit=10)
|
||||
except:
|
||||
continue
|
||||
|
||||
# Iterate over all (in reverse order so the latest appear
|
||||
# the last in the console) and print them with format:
|
||||
|
|
Loading…
Reference in New Issue
Block a user