From f9a7bee99dbc30db32c1e9aa9866a6c159dc3cb5 Mon Sep 17 00:00:00 2001 From: Ske Date: Sun, 15 Jul 2018 00:13:23 +0200 Subject: [PATCH] Omit year if year is considered invalid --- bot/pluralkit/utils.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bot/pluralkit/utils.py b/bot/pluralkit/utils.py index 8f56f84f..993051ed 100644 --- a/bot/pluralkit/utils.py +++ b/bot/pluralkit/utils.py @@ -11,7 +11,7 @@ from pluralkit import db from pluralkit.bot import client, logger def escape(s): - return s.replace("`", "\`") + return s.replace("`", "\\`") def generate_hid() -> str: return "".join(random.choices(string.ascii_lowercase, k=5)) @@ -257,8 +257,10 @@ async def generate_member_info_card(conn, member: asyncpg.Record) -> discord.Emb card.colour = int(member["color"], 16) if member["birthday"]: - card.add_field(name="Birthdate", - value=member["birthday"].strftime("%b %d, %Y")) + bday_val = member["birthday"].strftime("%b %d, %Y") + if member["birthday"].year < 1000: + bday_val = member["birthday"].strftime("%b %d") + card.add_field(name="Birthdate", value=bday_val) if member["pronouns"]: card.add_field(name="Pronouns", value=member["pronouns"])