Added property that removes emojis from the name

This commit is contained in:
Casey 2022-09-23 18:31:16 +03:00
parent cfe26cfd8f
commit cb4b32fa8b
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 9 additions and 0 deletions

View File

@ -110,6 +110,15 @@ class Account:
def name(self) -> str: def name(self) -> str:
return self.display_name or self.username 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 @dataclass
class AttachmentMetaImage: class AttachmentMetaImage: