diff options
author | 2021-05-15 13:31:34 -0400 | |
---|---|---|
committer | 2021-05-15 13:31:34 -0400 | |
commit | f8a179df350eb3abb7f3595aaff3dbca312f540c (patch) | |
tree | 6868ae98b81b614f8d8d68f1a9bbc06c7cb94490 /bot/exts/easter/egg_facts.py | |
parent | chore: Make all aliases in commands tuples (diff) |
chore: Make things that are only used once constants
Diffstat (limited to 'bot/exts/easter/egg_facts.py')
-rw-r--r-- | bot/exts/easter/egg_facts.py | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/bot/exts/easter/egg_facts.py b/bot/exts/easter/egg_facts.py index d60032f0..ee383171 100644 --- a/bot/exts/easter/egg_facts.py +++ b/bot/exts/easter/egg_facts.py @@ -12,6 +12,8 @@ from bot.utils.decorators import seasonal_task log = logging.getLogger(__name__) +EGG_FACTS = loads(Path("bot/resources/easter/easter_egg_facts.json").read_text("utf8")) + class EasterFacts(commands.Cog): """ @@ -22,16 +24,8 @@ class EasterFacts(commands.Cog): def __init__(self, bot: Bot): self.bot = bot - self.facts = self.load_json() - self.daily_fact_task = self.bot.loop.create_task(self.send_egg_fact_daily()) - @staticmethod - def load_json() -> dict: - """Load a list of easter egg facts from the resource JSON file.""" - p = Path("bot/resources/easter/easter_egg_facts.json") - return loads(p.read_text("utf8")) - @seasonal_task(Month.APRIL) async def send_egg_fact_daily(self) -> None: """A background task that sends an easter egg fact in the event channel everyday.""" @@ -51,7 +45,7 @@ class EasterFacts(commands.Cog): return discord.Embed( colour=Colours.soft_red, title="Easter Egg Fact", - description=random.choice(self.facts) + description=random.choice(EGG_FACTS) ) |