forked from chen310/NeteaseCloudMusicTasks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
replyComment.py
36 lines (32 loc) · 1.08 KB
/
replyComment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import random
import time
from . import publishComment
def start(user, task={}):
music = user.music
if len(user.comments) > 0:
commentId = user.comments[0]['commentId']
songId = user.comments[0]['songId']
else:
if len(task['id']) > 0:
# 发布主创说
publishComment.start(user, user.user_setting['musician_task']['755000'])
else:
return
time.sleep(5)
if len(user.comments) > 0:
commentId = user.comments[0]['commentId']
songId = user.comments[0]['songId']
else:
return user.taskInfo(task['taskName'] + '-发布评论', '发布失败')
if len(task['msg']) > 0:
msg = random.choice(task['msg'])
else:
msg = '感谢收听'
resp = music.comments_reply(
songId, commentId, msg)
if resp['code'] == 200:
user.replies.append(
{'commentId': resp['comment']['commentId'], 'songId': songId})
user.taskInfo(task['taskName'], '回复成功')
else:
user.taskInfo(task['taskName'] + '-回复评论', user.errMsg(resp))