调整json数据
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user