Add command support for no-year birthdates
This commit is contained in:
parent
f9a7bee99d
commit
b8539ec525
@ -293,6 +293,12 @@ async def member_set(conn, message, member, args):
|
||||
if prop == "birthdate":
|
||||
try:
|
||||
value = datetime.strptime(value, "%Y-%m-%d").date()
|
||||
except ValueError:
|
||||
try:
|
||||
# Try again, adding 0001 as a placeholder year
|
||||
# This is considered a "null year" and will be omitted from the info card
|
||||
# Useful if you want your birthday to be displayed yearless.
|
||||
value = value = datetime.strptime("0001-" + value, "%Y-%m-%d").date()
|
||||
except ValueError:
|
||||
return False, "Invalid date. Date must be in ISO-8601 format (eg. 1999-07-25)."
|
||||
|
||||
|
@ -62,6 +62,7 @@ For example:
|
||||
`pk;member set John color #ff0000` - Changes John's color to red.
|
||||
`pk;member set John pronouns he/him` - Changes John's pronouns.
|
||||
`pk;member set John birthdate 1996-02-27` - Changes John's birthdate to Feb 27, 1996. (Must be YYYY-MM-DD format).
|
||||
`pk;member set John birthdate 02-27` - Changes John's birthdate to February 27th, with no year.
|
||||
`pk;member set John avatar https://placekitten.com/400/400` - Changes John's avatar to a linked image.
|
||||
`pk;member set John avatar @JohnsAccount` - Changes John's avatar to the avatar of the mentioned account."""),
|
||||
("Removing a member",
|
||||
|
Loading…
Reference in New Issue
Block a user