diff options
Diffstat (limited to 'bot/exts/evergreen')
-rw-r--r-- | bot/exts/evergreen/branding.py | 4 | ||||
-rw-r--r-- | bot/exts/evergreen/magic_8ball.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/recommend_game.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/snakes/converter.py | 4 | ||||
-rw-r--r-- | bot/exts/evergreen/speedrun.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/trivia_quiz.py | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 1d463c5b..7e531011 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -171,7 +171,7 @@ class BrandingManager(commands.Cog): def _read_config(self) -> t.Dict[str, bool]: """Read and return persistent config file.""" - with self.config_file.open("r") as persistent_file: + with self.config_file.open("r", encoding="utf8") as persistent_file: return json.load(persistent_file) def _write_config(self, key: str, value: bool) -> None: @@ -179,7 +179,7 @@ class BrandingManager(commands.Cog): current_config = self._read_config() current_config[key] = value - with self.config_file.open("w") as persistent_file: + with self.config_file.open("w", encoding="utf8") as persistent_file: json.dump(current_config, persistent_file) async def _daemon_func(self) -> None: diff --git a/bot/exts/evergreen/magic_8ball.py b/bot/exts/evergreen/magic_8ball.py index c10f1f51..f974e487 100644 --- a/bot/exts/evergreen/magic_8ball.py +++ b/bot/exts/evergreen/magic_8ball.py @@ -13,7 +13,7 @@ class Magic8ball(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot - with open(Path("bot/resources/evergreen/magic8ball.json"), "r") as file: + with open(Path("bot/resources/evergreen/magic8ball.json"), "r", encoding="utf8") as file: self.answers = json.load(file) @commands.command(name="8ball") diff --git a/bot/exts/evergreen/recommend_game.py b/bot/exts/evergreen/recommend_game.py index 7cd52c2c..5e262a5b 100644 --- a/bot/exts/evergreen/recommend_game.py +++ b/bot/exts/evergreen/recommend_game.py @@ -11,7 +11,7 @@ game_recs = [] # Populate the list `game_recs` with resource files for rec_path in Path("bot/resources/evergreen/game_recs").glob("*.json"): - with rec_path.open(encoding='utf-8') as file: + with rec_path.open(encoding='utf8') as file: data = json.load(file) game_recs.append(data) shuffle(game_recs) diff --git a/bot/exts/evergreen/snakes/converter.py b/bot/exts/evergreen/snakes/converter.py index d4e93b56..55609b8e 100644 --- a/bot/exts/evergreen/snakes/converter.py +++ b/bot/exts/evergreen/snakes/converter.py @@ -63,12 +63,12 @@ class Snake(Converter): """Build list of snakes from the static snake resources.""" # Get all the snakes if cls.snakes is None: - with (SNAKE_RESOURCES / "snake_names.json").open() as snakefile: + with (SNAKE_RESOURCES / "snake_names.json").open(encoding="utf8") as snakefile: cls.snakes = json.load(snakefile) # Get the special cases if cls.special_cases is None: - with (SNAKE_RESOURCES / "special_snakes.json").open() as snakefile: + with (SNAKE_RESOURCES / "special_snakes.json").open(encoding="utf8") as snakefile: special_cases = json.load(snakefile) cls.special_cases = {snake['name'].lower(): snake for snake in special_cases} diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py index 4e8d7aee..21aad5aa 100644 --- a/bot/exts/evergreen/speedrun.py +++ b/bot/exts/evergreen/speedrun.py @@ -6,7 +6,7 @@ from random import choice from discord.ext import commands log = logging.getLogger(__name__) -with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf-8") as file: +with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf8") as file: LINKS = json.load(file) diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index c1a271e8..8dceceac 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -40,7 +40,7 @@ class TriviaQuiz(commands.Cog): def load_questions() -> dict: """Load the questions from the JSON file.""" p = Path("bot", "resources", "evergreen", "trivia_quiz.json") - with p.open() as json_data: + with p.open(encoding="utf8") as json_data: questions = json.load(json_data) return questions |