PaiGram/metadata/scripts/paimon_moe.py
洛水居室 ab1c490a13
♻️ 重构 gacha_log
Co-authored-by: xtaodada <xtao@xtaolink.cn>
2022-10-21 19:34:49 +08:00

15 lines
557 B
Python

from utils.const import PROJECT_ROOT
from aiofiles import open as async_open
from httpx import AsyncClient, URL
async def update_paimon_moe_zh(overwrite: bool = True):
path = PROJECT_ROOT.joinpath("metadata/data/paimon_moe_zh.json")
if not overwrite and path.exists():
return
host = URL("https://raw.fastgit.org/MadeBaruna/paimon-moe/main/src/locales/items/zh.json")
client = AsyncClient()
text = (await client.get(host)).text
async with async_open(path, mode="w", encoding="utf-8") as file:
await file.write(text)