mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Call .sync_updates on .connect iff exported_auth is None
Calling this method on exported clients would trigger a UserMigrateError because it was being used on a non-native data center. For .connects like this, don't attempt syncing updates.
This commit is contained in:
		
							parent
							
								
									18e485ded2
								
							
						
					
					
						commit
						8ecd2c2e06
					
				| 
						 | 
				
			
			@ -201,13 +201,16 @@ class TelegramBareClient:
 | 
			
		|||
                    self(GetConfigRequest()).dc_options
 | 
			
		||||
 | 
			
		||||
            # Connection was successful! Try syncing the update state
 | 
			
		||||
            # IF we don't have an exported authorization (hence we're
 | 
			
		||||
            # not in our NATIVE data center or we'd get UserMigrateError)
 | 
			
		||||
            # to also assert whether the user is logged in or not.
 | 
			
		||||
            self._user_connected = True
 | 
			
		||||
            try:
 | 
			
		||||
                self.sync_updates()
 | 
			
		||||
                self._set_connected_and_authorized()
 | 
			
		||||
            except UnauthorizedError:
 | 
			
		||||
                self._authorized = False
 | 
			
		||||
            if not exported_auth:
 | 
			
		||||
                try:
 | 
			
		||||
                    self.sync_updates()
 | 
			
		||||
                    self._set_connected_and_authorized()
 | 
			
		||||
                except UnauthorizedError:
 | 
			
		||||
                    self._authorized = False
 | 
			
		||||
 | 
			
		||||
            return True
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user