From a74debb82dba47ac843ac6b769d8d6d50f3e2f30 Mon Sep 17 00:00:00 2001 From: kwzrd Date: Wed, 1 Apr 2020 09:40:30 +0200 Subject: Deseasonify: implement __str__ for Month enum This way, we can standardize the way Months are shown to both the user and the developer. Note that if passing a Month member to an f-string, the `!s` format code must be specified to ensure our __str__ is used. Co-authored-by: MarkKoz --- bot/constants.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'bot/constants.py') diff --git a/bot/constants.py b/bot/constants.py index 22ea9177..638448ea 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -149,6 +149,9 @@ class Month(enum.IntEnum): NOVEMBER = 11 DECEMBER = 12 + def __str__(self) -> str: + return self.name.title() + # If a month override was configured, check that it's a valid Month # Prevents delaying an exception after the bot starts -- cgit v1.2.3