Update maimai
This commit is contained in:
parent
5ed4165f04
commit
d1768275c4
2 changed files with 4 additions and 6 deletions
|
@ -166,7 +166,7 @@ async def _(msg: Bot.MessageSession, username: str = None):
|
|||
|
||||
@mai.handle('info <id_or_alias> [<username>] {{maimai.help.info}}')
|
||||
async def _(msg: Bot.MessageSession, id_or_alias: str, username: str = None):
|
||||
if id_or_alias.isdigit():
|
||||
if id_or_alias.isdigit() and len(id_or_alias) <=5:
|
||||
sid = id_or_alias
|
||||
else:
|
||||
sid_list = await get_alias(id_or_alias, get_music=True)
|
||||
|
@ -332,7 +332,7 @@ async def _(msg: Bot.MessageSession):
|
|||
|
||||
@mai.handle('song <id_or_alias> [<diff>] {{maimai.help.song}}')
|
||||
async def _(msg: Bot.MessageSession, id_or_alias: str, diff: str = None):
|
||||
if id_or_alias.isdigit():
|
||||
if id_or_alias.isdigit() and len(id_or_alias) <=5:
|
||||
sid = id_or_alias
|
||||
else:
|
||||
sid_list = await get_alias(id_or_alias, get_music=True)
|
||||
|
|
|
@ -63,7 +63,7 @@ async def _(msg: Bot.MessageSession):
|
|||
res = msg.locale.t("maimai.message.song.prompt") + "\n"
|
||||
for sid in sorted(sid_list, key=int):
|
||||
s = (await total_list.get()).by_id(sid)
|
||||
res += f"{s['id']} {s['title']}{' (DX)' if s['type'] == 'DX' else ''}\n"
|
||||
res += f"{s['id']}\u200B. {s['title']}{' (DX)' if s['type'] == 'DX' else ''}\n"
|
||||
await msg.finish(res.strip())
|
||||
else:
|
||||
music = (await total_list.get()).by_id(str(sid_list[0]))
|
||||
|
@ -78,11 +78,9 @@ async def _(msg: Bot.MessageSession):
|
|||
level='/'.join((str(ds) for ds in music['ds']))))])
|
||||
|
||||
|
||||
@mai_regex.handle(re.compile(r"(.+)\s?有什(么别|麼別)名"), desc='{maimai.help.maimai_regex.alias}')
|
||||
@mai_regex.handle(re.compile(r"(\d+)\s?有什(么别|麼別)名"), desc='{maimai.help.maimai_regex.alias}')
|
||||
async def _(msg: Bot.MessageSession):
|
||||
sid = msg.matched_msg.groups()[0]
|
||||
if not sid.isdigit():
|
||||
return
|
||||
music = (await total_list.get()).by_id(sid)
|
||||
if not music:
|
||||
await msg.finish(msg.locale.t("maimai.message.music_not_found"))
|
||||
|
|
Reference in a new issue