diff options
| author | 2021-05-13 13:34:06 -0400 | |
|---|---|---|
| committer | 2021-05-13 13:34:06 -0400 | |
| commit | 2aa1916d5c8e4832f26f6da4094238e9a0021d1c (patch) | |
| tree | 2ce3195a019ef84fd0b2d6509f5deec7b25e19bc /bot/exts/pride | |
| parent | fix: Resolve Merge Conflicts (diff) | |
chore: Use pathlib.Path.read_text & write_text over open
Diffstat (limited to 'bot/exts/pride')
| -rw-r--r-- | bot/exts/pride/drag_queen_name.py | 3 | ||||
| -rw-r--r-- | bot/exts/pride/pride_anthem.py | 4 | ||||
| -rw-r--r-- | bot/exts/pride/pride_facts.py | 3 |
3 files changed, 3 insertions, 7 deletions
diff --git a/bot/exts/pride/drag_queen_name.py b/bot/exts/pride/drag_queen_name.py index d9424001..6bf43913 100644 --- a/bot/exts/pride/drag_queen_name.py +++ b/bot/exts/pride/drag_queen_name.py @@ -19,8 +19,7 @@ class DragNames(commands.Cog): @staticmethod def load_names() -> list: """Loads a list of drag queen names.""" - with Path("bot/resources/pride/drag_queen_names.json").open(encoding="utf8") as f: - return json.load(f) + return json.loads(Path("bot/resources/pride/drag_queen_names.json").read_text("utf8")) @commands.command(name="dragname", aliases=["dragqueenname", "queenme"]) async def dragname(self, ctx: commands.Context) -> None: diff --git a/bot/exts/pride/pride_anthem.py b/bot/exts/pride/pride_anthem.py index a7f8d7ef..21b7e468 100644 --- a/bot/exts/pride/pride_anthem.py +++ b/bot/exts/pride/pride_anthem.py @@ -36,9 +36,7 @@ class PrideAnthem(commands.Cog): @staticmethod def load_vids() -> list: """Loads a list of videos from the resources folder as dictionaries.""" - with open(Path("bot/resources/pride/anthems.json"), "r", encoding="utf8") as f: - anthems = json.load(f) - return anthems + return json.loads(Path("bot/resources/pride/anthems.json").read_text("utf8")) @commands.command(name="prideanthem", aliases=["anthem", "pridesong"]) async def prideanthem(self, ctx: commands.Context, genre: str = None) -> None: diff --git a/bot/exts/pride/pride_facts.py b/bot/exts/pride/pride_facts.py index 6d06cf64..47e69a03 100644 --- a/bot/exts/pride/pride_facts.py +++ b/bot/exts/pride/pride_facts.py @@ -28,8 +28,7 @@ class PrideFacts(commands.Cog): @staticmethod def load_facts() -> dict: """Loads a dictionary of years mapping to lists of facts.""" - with open(Path("bot/resources/pride/facts.json"), "r", encoding="utf8") as f: - return json.load(f) + return json.loads(Path("bot/resources/pride/facts.json").read_text("utf8")) @seasonal_task(Month.JUNE) async def send_pride_fact_daily(self) -> None: |