Create __init__.py
This commit is contained in:
parent
9edfed6736
commit
ca4c5f7c63
1 changed files with 30 additions and 0 deletions
30
modules/mkey/__init__.py
Normal file
30
modules/mkey/__init__.py
Normal 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"]}。')
|
Reference in a new issue