From a0693c4834ec7c1bdbfdcf914a287c1b318e102d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=9A=E7=BE=85=E7=8B=BC?= Date: Sun, 18 Jun 2023 14:52:04 +0800 Subject: [PATCH] too complex --- modules/maimai/locales/zh_cn.json | 2 +- modules/maimai/regex.py | 29 ++--------------------------- modules/wiki/inline.py | 2 +- 3 files changed, 4 insertions(+), 29 deletions(-) diff --git a/modules/maimai/locales/zh_cn.json b/modules/maimai/locales/zh_cn.json index 0931aa28..ebc8663c 100644 --- a/modules/maimai/locales/zh_cn.json +++ b/modules/maimai/locales/zh_cn.json @@ -31,7 +31,7 @@ "maimai.message.search": "“${keyword}”的搜索结果:", "maimai.message.song": "艺术家:${artist}\n分类:${genre}\nBPM:${bpm}\n版本:${version}\n难度:${level}", "maimai.message.song.dx": "${diff} ${level} (${ds})\nTAP:${tap}\nHOLD:${hold}\nSLIDE:${slide}\nTOUCH:${touch}\nBREAK:${brk}\n谱师:${charter}", - "maimai.message.song.prompt": "请回复 ID 选择对应歌曲:", + "maimai.message.song.prompt": "以下是可能的结果:", "maimai.message.song.sd": "${diff} ${level} (${ds})\nTAP:${tap}\nHOLD:${hold}\nSLIDE:${slide}\nBREAK:${brk}\n谱师:${charter}", "maimai.message.too_much": "结果过多(${length} 条),请缩小搜索范围。", "maimai.message.user_not_found": "未找到此玩家,请确保此玩家的用户名和查分器中的用户名相同。" diff --git a/modules/maimai/regex.py b/modules/maimai/regex.py index effbacdb..2756456a 100644 --- a/modules/maimai/regex.py +++ b/modules/maimai/regex.py @@ -8,7 +8,7 @@ from modules.maimai.libraries.maimaidx_music import * total_list = TotalList() mai_regex = module('maimai_regex', - desc='{maimai.help.maimai_regex.desc}', + desc='{maimai.help.maimai_regex.desc}', recommend_modules=['maimai'], alias='maimai_regex', developers=['DoroWolf']) @@ -30,32 +30,7 @@ async def _(msg: Bot.MessageSession): 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" - - reply = await msg.waitReply(res) - replied = reply.asDisplay(text_only=True) - - if replied.isdigit(): - replied = int(replied) - - lines = res.split("\n") - id_list = [] - - for line in lines: - parts = line.split() - - if len(parts) > 0: - first_part = parts[0] - - try: - song_id = int(first_part) - id_list.append(song_id) - except ValueError: - pass - - if replied in id_list: - music = (await total_list.get()).by_id(replied) - else: - return await msg.finish(msg.locale.t("maimai.message.error.non_digital")) + await msg.finish(res.strip()) else: music = (await total_list.get()).by_id(str(sid_list[0])) diff --git a/modules/wiki/inline.py b/modules/wiki/inline.py index 615c32cd..c1238ac9 100644 --- a/modules/wiki/inline.py +++ b/modules/wiki/inline.py @@ -15,7 +15,7 @@ from modules.wiki.utils.wikilib import WikiLib from .wiki import query_pages, generate_screenshot_v2_blocklist wiki_inline = module('wiki_inline', - desc='{wiki.help.wiki_inline.desc}', + desc='{wiki.help.wiki_inline.desc}', recommend_modules=['wiki'], alias='wiki_regex', developers=['OasisAkari'])