aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/easter
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/easter')
-rw-r--r--bot/exts/easter/april_fools_vids.py6
-rw-r--r--bot/exts/easter/bunny_name_generator.py3
-rw-r--r--bot/exts/easter/easter_riddle.py5
-rw-r--r--bot/exts/easter/egg_decorating.py6
-rw-r--r--bot/exts/easter/egg_facts.py5
-rw-r--r--bot/exts/easter/egghead_quiz.py5
-rw-r--r--bot/exts/easter/save_the_planet.py4
-rw-r--r--bot/exts/easter/traditions.py3
8 files changed, 14 insertions, 23 deletions
diff --git a/bot/exts/easter/april_fools_vids.py b/bot/exts/easter/april_fools_vids.py
index 3ce1f72a..5ef40704 100644
--- a/bot/exts/easter/april_fools_vids.py
+++ b/bot/exts/easter/april_fools_vids.py
@@ -1,6 +1,7 @@
import logging
import random
-from json import load
+from json import loads
+from pathlib import Path
from discord.ext import commands
@@ -8,8 +9,7 @@ from bot.bot import Bot
log = logging.getLogger(__name__)
-with open("bot/resources/easter/april_fools_vids.json", encoding="utf-8") as f:
- ALL_VIDS = load(f)
+ALL_VIDS = loads(Path("bot/resources/easter/april_fools_vids.json").read_text("utf-8"))
class AprilFoolVideos(commands.Cog):
diff --git a/bot/exts/easter/bunny_name_generator.py b/bot/exts/easter/bunny_name_generator.py
index 5e3b014d..adde8704 100644
--- a/bot/exts/easter/bunny_name_generator.py
+++ b/bot/exts/easter/bunny_name_generator.py
@@ -11,8 +11,7 @@ from bot.bot import Bot
log = logging.getLogger(__name__)
-with Path("bot/resources/easter/bunny_names.json").open("r", encoding="utf8") as f:
- BUNNY_NAMES = json.load(f)
+BUNNY_NAMES = json.loads(Path("bot/resources/easter/bunny_names.json").read_text("utf8"))
class BunnyNameGenerator(commands.Cog):
diff --git a/bot/exts/easter/easter_riddle.py b/bot/exts/easter/easter_riddle.py
index 9a253a6a..01b956f1 100644
--- a/bot/exts/easter/easter_riddle.py
+++ b/bot/exts/easter/easter_riddle.py
@@ -1,7 +1,7 @@
import asyncio
import logging
import random
-from json import load
+from json import loads
from pathlib import Path
import discord
@@ -12,8 +12,7 @@ from bot.constants import Colours, NEGATIVE_REPLIES
log = logging.getLogger(__name__)
-with Path("bot/resources/easter/easter_riddle.json").open("r", encoding="utf8") as f:
- RIDDLE_QUESTIONS = load(f)
+RIDDLE_QUESTIONS = loads(Path("bot/resources/easter/easter_riddle.json").read_text("utf8"))
TIMELIMIT = 10
diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py
index 3744989d..7448f702 100644
--- a/bot/exts/easter/egg_decorating.py
+++ b/bot/exts/easter/egg_decorating.py
@@ -15,11 +15,9 @@ from bot.utils import helpers
log = logging.getLogger(__name__)
-with open(Path("bot/resources/evergreen/html_colours.json"), encoding="utf8") as f:
- HTML_COLOURS = json.load(f)
+HTML_COLOURS = json.loads(Path("bot/resources/evergreen/html_colours.json").read_text("utf8"))
-with open(Path("bot/resources/evergreen/xkcd_colours.json"), encoding="utf8") as f:
- XKCD_COLOURS = json.load(f)
+XKCD_COLOURS = json.loads(Path("bot/resources/evergreen/xkcd_colours.json").read_text("utf8"))
COLOURS = [
(255, 0, 0, 255), (255, 128, 0, 255), (255, 255, 0, 255), (0, 255, 0, 255),
diff --git a/bot/exts/easter/egg_facts.py b/bot/exts/easter/egg_facts.py
index 8c93ca7b..c1c43f80 100644
--- a/bot/exts/easter/egg_facts.py
+++ b/bot/exts/easter/egg_facts.py
@@ -1,6 +1,6 @@
import logging
import random
-from json import load
+from json import loads
from pathlib import Path
import discord
@@ -30,8 +30,7 @@ class EasterFacts(commands.Cog):
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")
- with p.open(encoding="utf8") as f:
- return load(f)
+ return loads(p.read_text("utf8"))
@seasonal_task(Month.APRIL)
async def send_egg_fact_daily(self) -> None:
diff --git a/bot/exts/easter/egghead_quiz.py b/bot/exts/easter/egghead_quiz.py
index b6b1593d..4b67310f 100644
--- a/bot/exts/easter/egghead_quiz.py
+++ b/bot/exts/easter/egghead_quiz.py
@@ -1,7 +1,7 @@
import asyncio
import logging
import random
-from json import load
+from json import loads
from pathlib import Path
from typing import Union
@@ -13,8 +13,7 @@ from bot.constants import Colours
log = logging.getLogger(__name__)
-with open(Path("bot/resources/easter/egghead_questions.json"), "r", encoding="utf8") as f:
- EGGHEAD_QUESTIONS = load(f)
+EGGHEAD_QUESTIONS = loads(Path("bot/resources/easter/egghead_questions.json").read_text("utf8"))
EMOJIS = [
diff --git a/bot/exts/easter/save_the_planet.py b/bot/exts/easter/save_the_planet.py
index 444bb030..1bd515f2 100644
--- a/bot/exts/easter/save_the_planet.py
+++ b/bot/exts/easter/save_the_planet.py
@@ -7,9 +7,7 @@ from discord.ext import commands
from bot.bot import Bot
from bot.utils.randomization import RandomCycle
-
-with Path("bot/resources/easter/save_the_planet.json").open("r", encoding="utf8") as f:
- EMBED_DATA = RandomCycle(json.load(f))
+EMBED_DATA = RandomCycle(json.loads(Path("bot/resources/easter/save_the_planet.json").read_text("utf8")))
class SaveThePlanet(commands.Cog):
diff --git a/bot/exts/easter/traditions.py b/bot/exts/easter/traditions.py
index cb70f2d0..93404f3e 100644
--- a/bot/exts/easter/traditions.py
+++ b/bot/exts/easter/traditions.py
@@ -9,8 +9,7 @@ from bot.bot import Bot
log = logging.getLogger(__name__)
-with open(Path("bot/resources/easter/traditions.json"), "r", encoding="utf8") as f:
- traditions = json.load(f)
+traditions = json.loads(Path("bot/resources/easter/traditions.json").read_text("utf8"))
class Traditions(commands.Cog):