aiofiles is async. Need to use it properly.

This commit is contained in:
2024-05-22 20:06:50 -04:00
parent 6500f68d86
commit 9331e7ba4f
+4 -4
View File
@@ -410,8 +410,8 @@ async def update_clan_messages(guild: nextcord.Guild, channel_updates: Sequence[
for file_name in sorted_files:
message_name = f"{dir_name}/{file_name}"
file_path = f"{dir_path}/{file_name}"
with aiofiles.open(file_path, encoding="utf8") as reader:
await edit_clan_message(session, channel, message_name, reader.read(2000))
async with aiofiles.open(file_path, encoding="utf8") as reader:
await edit_clan_message(session, channel, message_name, await reader.read(2000))
async def get_clan_message_channel(session: Session, channel_name: str, guild: nextcord.Guild) -> nextcord.TextChannel:
@@ -542,8 +542,8 @@ async def edit_clan_council_info(guild: nextcord.Guild, config: DakinyConfig) ->
quarter = get_quarter_name(config)
with aiofiles.open(f"{TEMPLATES_DIR}/council_members.txt", encoding="utf8") as file:
message = file.read()
async with aiofiles.open(f"{TEMPLATES_DIR}/council_members.txt", encoding="utf8") as file:
message = await file.read()
message = message.format(
quarter=quarter,
council="\n".join(council_members_strs),