From cb4b32fa8bbeb0adba2306ee75cc46724a63ad7e Mon Sep 17 00:00:00 2001 From: hkc Date: Fri, 23 Sep 2022 18:31:16 +0300 Subject: [PATCH] Added property that removes emojis from the name --- mastoposter/types.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mastoposter/types.py b/mastoposter/types.py index f2cbeae..e44d762 100644 --- a/mastoposter/types.py +++ b/mastoposter/types.py @@ -110,6 +110,15 @@ class Account: def name(self) -> str: return self.display_name or self.username + @property + def name_emojiless(self) -> str: + if not self.display_name: + return self.username + name = self.display_name + for emoji in self.emojis: + name = name.replace(":%s:" % emoji.shortcode, "") + return name.strip() or self.username + @dataclass class AttachmentMetaImage: