Merge pull request #4 from muhammedfurkan/sourcery/dev-2.x

Sourcery refactored dev-2.x branch
This commit is contained in:
M.Furkan 2020-11-09 00:43:03 +03:00 committed by GitHub
commit b8cd2b61c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,11 +50,7 @@ class MessageEntity(base.TelegramObject):
if sys.maxunicode == 0xFFFF: if sys.maxunicode == 0xFFFF:
return text[self.offset : self.offset + self.length] return text[self.offset : self.offset + self.length]
if not isinstance(text, bytes): entity_text = text.encode("utf-16-le") if not isinstance(text, bytes) else text
entity_text = text.encode("utf-16-le")
else:
entity_text = text
entity_text = entity_text[self.offset * 2 : (self.offset + self.length) * 2] entity_text = entity_text[self.offset * 2 : (self.offset + self.length) * 2]
return entity_text.decode("utf-16-le") return entity_text.decode("utf-16-le")