From bd4dba3bf11964886270d0e3fc578a9312c25b5b Mon Sep 17 00:00:00 2001 From: Waffle Date: Tue, 26 Jan 2021 16:21:47 +0300 Subject: [PATCH] Remove `MessageEntity::text_from` because it's wrong (the method assumes UTF-8 indices, but the indices are UTF-16) (fuck you, telegram) --- src/types/message_entity.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/types/message_entity.rs b/src/types/message_entity.rs index fbd57216..872a1cb7 100644 --- a/src/types/message_entity.rs +++ b/src/types/message_entity.rs @@ -65,13 +65,6 @@ pub enum MessageEntityKind { Strikethrough, } -impl MessageEntity { - pub fn text_from(&self, message: &Message) -> Option { - let text = message.text(); - Some(String::from(&text?[self.offset..self.offset + self.length])) - } -} - #[cfg(test)] mod tests { use super::*;