Omit year if year is considered invalid

This commit is contained in:
Ske 2018-07-15 00:13:23 +02:00
parent af4f2025da
commit f9a7bee99d

View File

@ -11,7 +11,7 @@ from pluralkit import db
from pluralkit.bot import client, logger from pluralkit.bot import client, logger
def escape(s): def escape(s):
return s.replace("`", "\`") return s.replace("`", "\\`")
def generate_hid() -> str: def generate_hid() -> str:
return "".join(random.choices(string.ascii_lowercase, k=5)) 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) card.colour = int(member["color"], 16)
if member["birthday"]: if member["birthday"]:
card.add_field(name="Birthdate", bday_val = member["birthday"].strftime("%b %d, %Y")
value=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"]: if member["pronouns"]:
card.add_field(name="Pronouns", value=member["pronouns"]) card.add_field(name="Pronouns", value=member["pronouns"])