aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/easter/egg_facts.py
diff options
context:
space:
mode:
authorGravatar ToxicKidz <[email protected]>2021-05-15 13:31:34 -0400
committerGravatar ToxicKidz <[email protected]>2021-05-15 13:31:34 -0400
commitf8a179df350eb3abb7f3595aaff3dbca312f540c (patch)
tree6868ae98b81b614f8d8d68f1a9bbc06c7cb94490 /bot/exts/easter/egg_facts.py
parentchore: 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.py12
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)
)