Archived
1
0
Fork 0

Create __init__.py

This commit is contained in:
yzhh 2023-09-02 16:58:11 +08:00
parent 9edfed6736
commit ca4c5f7c63

30
modules/mkey/__init__.py Normal file
View file

@ -0,0 +1,30 @@
from core.component import module
from core.builtins import Bot
from core.utils.http import get_url
mk = module('mkey', desc='计算任天堂系列主机的家长控制重置密码。', developers=['OasisAkari', 'Kurisu'])
@mk.handle('<device> <month> <day> <inquiry_num> [<device_id>]')
async def mkey(msg: Bot.MessageSession, device: str, month: int, day: int, inquiry: str, device_id: str = None):
device_codes = {
"3ds": "CTR",
"dsi": "TWL",
"wii": "RVL",
"wiiu": "WUP",
"switch": "HAC"
}
if month < 1 or month > 12:
await msg.finish('无效的月份。')
if day < 1 or day > 31:
await msg.finish('无效的日期。')
device_code = device_codes[device.lower()]
api_call = f"https://mkey.eiphax.tech/api?platform={device_code}&inquiry={inquiry}&month={month}&day={day}"
if device_id:
api_call += f"&aux={device_id}"
result = await get_url(api_call, '200', fmt='json')
await msg.finish(f'您的重置密码是:{result["key"]}')