mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +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
 | 
					                # History
 | 
				
			||||||
                elif msg == '!h':
 | 
					                elif msg == '!h':
 | 
				
			||||||
                    # First retrieve the messages and some information
 | 
					                    # First retrieve the messages and some information
 | 
				
			||||||
 | 
					                    try:
 | 
				
			||||||
                        total_count, messages, senders = self.get_message_history(
 | 
					                        total_count, messages, senders = self.get_message_history(
 | 
				
			||||||
                        entity, limit=10)
 | 
					                        entity, limit=10)
 | 
				
			||||||
 | 
					                    except:
 | 
				
			||||||
 | 
					                        continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    # Iterate over all (in reverse order so the latest appear
 | 
					                    # Iterate over all (in reverse order so the latest appear
 | 
				
			||||||
                    # the last in the console) and print them with format:
 | 
					                    # the last in the console) and print them with format:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user