diff options
author | 2020-02-22 20:14:57 +0100 | |
---|---|---|
committer | 2020-02-22 20:14:57 +0100 | |
commit | 5adbdd6d9fc10faae0e5362e1494d9c80433f177 (patch) | |
tree | 2a187ca7bc516712c6559177ed38dd8111dd90ce | |
parent | Merge branch 'master' into seasonal-purge (diff) |
Add IntEnum for the 12 months
This is a safe way to specify which months a command can be used in.
The enum's values behave as ints when being passed to the datetime.date
initialiser.
-rw-r--r-- | bot/constants.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/bot/constants.py b/bot/constants.py index f0656926..2e4b4369 100644 --- a/bot/constants.py +++ b/bot/constants.py @@ -1,11 +1,12 @@ +import enum import logging +from datetime import datetime from os import environ from typing import NamedTuple -from datetime import datetime __all__ = ( "bookmark_icon_url", - "AdventOfCode", "Channels", "Client", "Colours", "Emojis", "Hacktoberfest", "Roles", "Tokens", + "AdventOfCode", "Channels", "Client", "Colours", "Emojis", "Hacktoberfest", "Month", "Roles", "Tokens", "WHITELISTED_CHANNELS", "STAFF_ROLES", "MODERATION_ROLES", "POSITIVE_REPLIES", "NEGATIVE_REPLIES", "ERROR_REPLIES", ) @@ -112,6 +113,21 @@ class Hacktoberfest(NamedTuple): voice_id = 514420006474219521 +class Month(enum.IntEnum): + january = 1 + february = 2 + march = 3 + april = 4 + may = 5 + june = 6 + july = 7 + august = 8 + september = 9 + october = 10 + november = 11 + december = 12 + + class Roles(NamedTuple): admin = int(environ.get("SEASONALBOT_ADMIN_ROLE_ID", 267628507062992896)) announcements = 463658397560995840 |