Skip to content

Commit

Permalink
更改 markdown 推送样式
Browse files Browse the repository at this point in the history
  • Loading branch information
chen310 committed Mar 30, 2022
1 parent 049d584 commit 729f0ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def md2text(data):
data = re.sub(r'- ', r' •', data)
data = re.sub(r'#### (.*?)\n', r'【\1】\n\n', data)
data = re.sub(r'### ', r'\n', data)
data = data.replace('`', '')
return data


Expand Down
21 changes: 12 additions & 9 deletions user.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,18 @@ def login_check(self, username, pwd='', cookie='', countrycode='', ip=''):

def taskTitle(self, title):
self.msg += '#### ' + title + '\n'
print('#### ' + title)
print('' + title + '】')

def taskInfo(self, key, value=''):
def taskInfo(self, key, value='', useCodeblock=True):
if value == '':
self.msg += '- ' + str(key) + '\n'
print('- ' + str(key))
print(' • ' + str(key))
elif useCodeblock:
self.msg += '- ' + str(key) + ': `' + str(value) + '`\n'
print(' • ' + str(key) + ': ' + str(value))
else:
self.msg += '- ' + str(key) + ': ' + str(value) + '\n'
print('- ' + str(key) + ': ' + str(value))
print(' ' + str(key) + ': ' + str(value))


def finishTask(self):
Expand Down Expand Up @@ -327,7 +330,7 @@ def auto_daka(self):
self.taskInfo('听歌总数', str(resp['listenSongs']) + '首')
if resp['listenSongs'] - self.songnumber < 300:
self.taskInfo(
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')')
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')', False)
return
else:
total = 300 - (resp['listenSongs'] - self.songnumber)
Expand All @@ -348,7 +351,7 @@ def auto_daka(self):
self.taskInfo('听歌总数', str(resp['listenSongs']) + '首')
if resp['listenSongs'] - self.songnumber < 300:
self.taskInfo(
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')')
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')', False)
self.finishTask()

def daka(self):
Expand Down Expand Up @@ -412,7 +415,7 @@ def daka(self):
self.taskInfo('听歌总数', str(resp['listenSongs']) + '首')
if resp['listenSongs'] - self.listenSongs < 300:
self.taskInfo(
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')')
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')', False)
return

time.sleep(user_setting['daka']['sleep_time'] + 5)
Expand All @@ -425,7 +428,7 @@ def daka(self):
self.taskInfo('听歌总数', str(resp['listenSongs']) + '首')
if resp['listenSongs'] - self.listenSongs < 300:
self.taskInfo(
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')')
'温馨提示', '数据更新可能有延时,[点击查看最新数据](https://music.163.com/#/user/home?id='+str(self.uid)+')', False)
self.finishTask()

def play_playlists(self):
Expand Down Expand Up @@ -527,7 +530,7 @@ def follow(self):
self.taskInfo('感谢关注', author_nickname)
# self.taskInfo('如果不想关注,请在配置文件里修改,并在官方客户端里取消关注')
self.taskInfo(
'如果不想关注,请在配置文件里修改,并在[主页](https://music.163.com/#/user/home?id='+str(author_uid)+')里取消关注')
'如果不想关注,请在配置文件里修改,并在[主页](https://music.163.com/#/user/home?id='+str(author_uid)+')里取消关注', False)
self.finishTask()

def sign(self):
Expand Down

0 comments on commit 729f0ec

Please sign in to comment.