mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-10-31 16:07:44 +03:00 
			
		
		
		
	Remove additional check when calculating emojies length
This special check treated some emojies as 3 characters long but this shouldn't have actually been done, likely due to the old regex matching more things as emoji than it should (which would have count as 2 too, making up for 1+3 from the new is_emoji()).
This commit is contained in:
		
							parent
							
								
									2609bd9bd1
								
							
						
					
					
						commit
						0a14aa1bc6
					
				|  | @ -91,15 +91,10 @@ def is_emoji(char): | |||
| 
 | ||||
| def emojiness(char): | ||||
|     """ | ||||
|     Returns the "emojiness" of an emoji, or how many characters it counts as. | ||||
|     1 if it's not an emoji, 2 usual, 3 "special" (seem to count more). | ||||
|     Returns 2 if the character is an emoji, or 1 otherwise. | ||||
|     This seems to be the length Telegram uses for offsets and lengths. | ||||
|     """ | ||||
|     if not is_emoji(char): | ||||
|         return 1 | ||||
|     if ord(char) < 129296: | ||||
|         return 2 | ||||
|     else: | ||||
|         return 3 | ||||
|     return 2 if is_emoji(char) else 1 | ||||
| 
 | ||||
| 
 | ||||
| def parse(message, delimiters=None, url_re=None): | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user