mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 09:57:29 +03:00 
			
		
		
		
	Fix .get_peer_id not working with full entities
This commit is contained in:
		
							parent
							
								
									10eca82143
								
							
						
					
					
						commit
						16f929b8b6
					
				| 
						 | 
					@ -321,6 +321,10 @@ def get_peer_id(peer, add_mark=False):
 | 
				
			||||||
            i = peer.channel_id  # IDs will be strictly positive -> log works
 | 
					            i = peer.channel_id  # IDs will be strictly positive -> log works
 | 
				
			||||||
            return -(i + pow(10, math.floor(math.log10(i) + 3)))
 | 
					            return -(i + pow(10, math.floor(math.log10(i) + 3)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Maybe a full entity was given and we just need its ID
 | 
				
			||||||
 | 
					    try:
 | 
				
			||||||
 | 
					        return get_peer_id(get_input_peer(peer), add_mark=add_mark)
 | 
				
			||||||
 | 
					    except ValueError:
 | 
				
			||||||
        _raise_cast_fail(peer, 'int')
 | 
					        _raise_cast_fail(peer, 'int')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user