From 3f79384383b34337c8b3059bad0738b3687f03d4 Mon Sep 17 00:00:00 2001 From: ZoruaFox Date: Sat, 13 Jan 2024 03:07:42 +0800 Subject: [PATCH] fix unable to get basic chart problem 0 == False --- modules/maimai/chunithm.py | 4 ++-- modules/maimai/maimai.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/maimai/chunithm.py b/modules/maimai/chunithm.py index 2bc77101..47378f58 100644 --- a/modules/maimai/chunithm.py +++ b/modules/maimai/chunithm.py @@ -140,8 +140,8 @@ async def _(msg: Bot.MessageSession, song: str, diff: str = None): await msg.finish(msg.locale.t("maimai.message.music_not_found")) if diff: - diff_index = get_diff(diff) - if not diff_index or (len(music['ds']) == 4 and diff_index == 4): + diff_index = get_diff(diff) # diff_index 的结果可能为 0 + if (not diff_index and diff_index != 0) or (len(music['ds']) == 4 and diff_index == 4): await msg.finish(msg.locale.t("maimai.message.chart_not_found")) chart = music['charts'][diff_index] ds = music['ds'][diff_index] diff --git a/modules/maimai/maimai.py b/modules/maimai/maimai.py index e9c02043..4a8a322a 100644 --- a/modules/maimai/maimai.py +++ b/modules/maimai/maimai.py @@ -218,8 +218,8 @@ async def _(msg: Bot.MessageSession, id_or_alias: str, diff: str = None): await msg.finish(msg.locale.t("maimai.message.music_not_found")) if diff: - diff_index = get_diff(diff) - if not diff_index or (len(music['ds']) == 4 and diff_index == 4): + diff_index = get_diff(diff) # diff_index 的结果可能为 0 + if (not diff_index and diff_index != 0) or (len(music['ds']) == 4 and diff_index == 4): await msg.finish(msg.locale.t("maimai.message.chart_not_found")) chart = music['charts'][diff_index] ds = music['ds'][diff_index]