mirror of
https://github.com/TeamPGM/PagerMaid_Plugins_Pyro.git
synced 2024-11-16 05:45:24 +00:00
netease_comment 随机一条网易云音乐评论
Co-authored-by: KorenKrita <spczd@hrbeu.edu.cn>
This commit is contained in:
parent
30e50f50d5
commit
c146254bb6
10
list.json
10
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"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
19
netease_comment/main.py
Normal file
19
netease_comment/main.py
Normal file
@ -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'] + ' 在鸽曲 <a href="' + str(data['music_url']) + '">' + \
|
||||
data['name'] + ' --by' + data['artists_name'] + '</a>' + ' 下方的评论。'
|
||||
return await message.edit(res, disable_web_page_preview=False)
|
||||
except Exception:
|
||||
continue
|
||||
await message.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
|
Loading…
Reference in New Issue
Block a user