diff --git a/list.json b/list.json index f4927f7..2ac4038 100644 --- a/list.json +++ b/list.json @@ -389,6 +389,16 @@ "supported": true, "des-short": "每日问候。", "des": "每日问候。\n指令:,everyday_greet" + }, + { + "name": "netease_comment", + "version": "1.0", + "section": "chat", + "maintainer": "xtaodada、KorenKrita", + "size": "0.89 kb", + "supported": true, + "des-short": "随机一条网易云音乐评论。", + "des": "随机一条网易云音乐评论。\n指令:,netease_comment" } ] } diff --git a/netease_comment/main.py b/netease_comment/main.py new file mode 100644 index 0000000..d34d2db --- /dev/null +++ b/netease_comment/main.py @@ -0,0 +1,19 @@ +from pagermaid.listener import listener +from pagermaid.single_utils import Message + + +@listener(command="netease_comment", + description="随机一条网易云音乐评论。") +async def netease(message: Message): + for _ in range(5): + try: + req = await message.request.get("https://api.66mz8.com/api/music.163.php?format=json") + assert req.status_code == 200 + data = req.json() + res = data['comments'] + '\n\n来自 @' + data[ + 'nickname'] + ' 在鸽曲 ' + \ + data['name'] + ' --by' + data['artists_name'] + '' + ' 下方的评论。' + return await message.edit(res, disable_web_page_preview=False) + except Exception: + continue + await message.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")