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/halloween/monstersurvey.py | |
parent | fix: Resolve Merge Conflicts (diff) |
chore: Use pathlib.Path.read_text & write_text over open
Diffstat (limited to 'bot/exts/halloween/monstersurvey.py')
-rw-r--r-- | bot/exts/halloween/monstersurvey.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/bot/exts/halloween/monstersurvey.py b/bot/exts/halloween/monstersurvey.py index 231454ea..240a97db 100644 --- a/bot/exts/halloween/monstersurvey.py +++ b/bot/exts/halloween/monstersurvey.py @@ -26,14 +26,12 @@ class MonsterSurvey(Cog): def __init__(self): """Initializes values for the bot to use within the voting commands.""" self.registry_path = pathlib.Path("bot", "resources", "halloween", "monstersurvey.json") - with self.registry_path.open(encoding="utf8") as data: - self.voter_registry = json.load(data) + self.voter_registry = json.loads(self.registry_path.read_text("utf8")) def json_write(self) -> None: """Write voting results to a local JSON file.""" log.info("Saved Monster Survey Results") - with self.registry_path.open("w", encoding="utf8") as data: - json.dump(self.voter_registry, data, indent=2) + self.registry_path.write_text(json.dumps(self.voter_registry, indent=2)) def cast_vote(self, id: int, monster: str) -> None: """ |