switch to aiofiles
@@ -3,7 +3,7 @@ from discord.ext import commands
from typing import Union
import classyjson as cj
import functools
-import aiofile
+import aiofiles
import discord
import random
import ast
@@ -88,7 +88,7 @@ class Owner(commands.Cog):
async with ctx.typing():
os.system("sudo git pull > git_pull_log 2>&1")
- async with aiofile.async_open("git_pull_log", "r") as f:
+ with aiofiles.open("git_pull_log", "r") as f:
await self.bot.send(ctx, f"```diff\n{await f.read()}\n```")
os.remove("git_pull_log")
@@ -98,12 +98,12 @@ class Owner(commands.Cog):
@commands.is_owner()
async def update(self, ctx, thing):
if thing.lower() == "data":
- async with aiofile.async_open("data/data.json", "r", encoding="utf8") as d:
+ async with aiofiles.open("data/data.json", "r", encoding="utf8") as d:
self.d = recursive_update(self.d, cj.loads(await d.read()))
self.d.findables = cj.classify(self.d.special_findables + self.d.default_findables)
elif thing.lower() == "text":
- async with aiofile.async_open("data/text.json", "r", encoding="utf8") as t: # recursive shit not needed here
+ async with aiofiles.open("data/text.json", "r", encoding="utf8") as t: # recursive shit not needed here
self.bot.langs.update(cj.loads(await t.read()))
elif thing.lower() == "mcservers":
self.d.additional_mcservers = await self.db.fetch_all_mcservers()
