From 62f2a4b8d667bf3c0820175a5dbd321b01eaaea5 Mon Sep 17 00:00:00 2001 From: liuwei Date: Tue, 3 Jun 2025 17:31:47 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4json=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/guess_song/main.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/plugins/guess_song/main.py b/plugins/guess_song/main.py index f7b3b60..0394aa8 100644 --- a/plugins/guess_song/main.py +++ b/plugins/guess_song/main.py @@ -326,16 +326,12 @@ class GuessSongPlugin(MessagePluginInterface): # 解析响应数据 json_data = response.json() - if not json_data.get("data") or json_data.get("code") != 200: - self.LOG.error(f"API 返回数据格式错误: {json_data}") - return {} - # 从歌曲列表中随机选择一首 song_list = json_data if not song_list or not isinstance(song_list, list) or len(song_list) == 0: self.LOG.error(f"未找到歌曲列表或列表为空") return {} - + self.LOG.debug(f"song_list:{song_list}") # 随机选择一首歌曲 random_song = random.choice(song_list) @@ -367,7 +363,7 @@ class GuessSongPlugin(MessagePluginInterface): } except Exception as e: - self.LOG.error(f"获取随机歌曲出错: {e}") + self.LOG.exception(f"获取随机歌曲出错: {e}") return {} async def _send_song_clip(self, bot: WechatAPIClient, song_info: Dict[str, Any], session_id: str) -> bool: