refactor: change text 'massage' to 'message'

This commit is contained in:
y1ndan 2020-12-31 09:47:12 +08:00
parent 662c02c7e5
commit 5c2d54470c

View File

@ -163,8 +163,8 @@ class Sign(object):
try: try:
rolesList = roles['data']['list'] rolesList = roles['data']['list']
except Exception as e: except Exception as e:
massage = roles['massage'] message = roles['message']
notify(sckey, '失败', massage) notify(sckey, '失败', message)
exit(-1) exit(-1)
else: else:
logging.info('当前账号绑定了 {} 个角色'.format(len(rolesList))) logging.info('当前账号绑定了 {} 个角色'.format(len(rolesList)))
@ -189,16 +189,16 @@ class Sign(object):
def run(self): def run(self):
logging.info('任务开始') logging.info('任务开始')
massageList = [] messageList = []
infoList = self.get_info() infoList = self.get_info()
for i in range(len(infoList)): for i in range(len(infoList)):
if infoList[i]['data']['is_sign'] is True: if infoList[i]['data']['is_sign'] is True:
#if infoList[i]['data']['is_sign'] is False: #if infoList[i]['data']['is_sign'] is False:
massage = '旅行者 {} 号,你已经签到过了'.format(i + 1) message = '旅行者 {} 号,你已经签到过了'.format(i + 1)
notify(sckey, '成功', massage) notify(sckey, '成功', message)
elif infoList[i]['data']['first_bind'] is True: elif infoList[i]['data']['first_bind'] is True:
massage = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1) message = '旅行者 {} 号,请先前往米游社绑定账号'.format(i + 1)
notify(sckey, '失败', massage) notify(sckey, '失败', message)
exit(-1) exit(-1)
else: else:
today = infoList[i]['data']['today'] today = infoList[i]['data']['today']
@ -226,16 +226,16 @@ class Sign(object):
# -5003: already signed in # -5003: already signed in
if code == 0: if code == 0:
status = '成功' status = '成功'
massageList.append(self.massage().format(today, messageList.append(self.message().format(today,
self._regionNameList[i], uid, award['name'], award['cnt'], self._regionNameList[i], uid, award['name'], award['cnt'],
totalSignDay, jdict['massage'])) totalSignDay, jdict['message']))
else: else:
status = '失败' status = '失败'
massageList = jdict messageList = jdict
return notify(sckey, status, massageList) return notify(sckey, status, messageList)
def massage(self): def message(self):
return ''' return '''
{:#^30} {:#^30}
🔅[{}]{} 🔅[{}]{}
@ -246,11 +246,11 @@ class Sign(object):
''' '''
def notify(sckey, status, massage): def notify(sckey, status, message):
if sckey.startswith('SC'): if sckey.startswith('SC'):
logging.info('准备推送通知...') logging.info('准备推送通知...')
url = 'https://sc.ftqq.com/{}.send'.format(sckey) url = 'https://sc.ftqq.com/{}.send'.format(sckey)
data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': massage} data = {'text': '原神签到小助手 签到{}'.format(status), 'desp': message}
try: try:
jdict = json.loads( jdict = json.loads(
requests.Session().post(url, data = data).text) requests.Session().post(url, data = data).text)
@ -266,7 +266,7 @@ def notify(sckey, status, massage):
else: else:
logging.info('未配置SCKEY,正在跳过推送') logging.info('未配置SCKEY,正在跳过推送')
logging.info('签到{}: {}'.format(status, massage)) logging.info('签到{}: {}'.format(status, message))
return logging.info('任务结束') return logging.info('任务结束')