Update
This commit is contained in:
parent
d0c5214890
commit
b8dfd702e8
4 changed files with 39 additions and 34 deletions
|
@ -93,11 +93,22 @@ async def _(msg: Bot.MessageSession, use_local=True):
|
|||
await msg.finish(msg.locale.t("arcaea.message.get_failed"))
|
||||
|
||||
|
||||
p = module('ptt',
|
||||
developers=['OasisAkari'])
|
||||
@arc.command('calc <score> <rating>')
|
||||
async def _(msg: Bot.MessageSession, score: int, rating: float):
|
||||
ptt = 0
|
||||
if score >= 10000000:
|
||||
ptt += 2
|
||||
elif score >= 9800000:
|
||||
ptt += 1 + (score - 9800000) / 200000
|
||||
else:
|
||||
ptt += (score - 9500000) / 300000
|
||||
await msg.finish([Plain(rating + ptt)])
|
||||
|
||||
|
||||
@p.handle('<potential> {{ptt.help}}')
|
||||
p = module('ptt', developers=['OasisAkari'])
|
||||
|
||||
|
||||
@p.command('<potential> {{ptt.help}}')
|
||||
async def pttimg(msg: Bot.MessageSession):
|
||||
ptt = msg.parsed_msg['<potential>']
|
||||
# ptt
|
||||
|
@ -169,15 +180,3 @@ async def pttimg(msg: Bot.MessageSession):
|
|||
savepath = random_cache_path() + '.png'
|
||||
pttimgr.save(savepath)
|
||||
await msg.finish([Img(path=savepath)])
|
||||
|
||||
|
||||
@arc.handle('calc <score> <rating>')
|
||||
async def _(msg: Bot.MessageSession, score: int, rating: float):
|
||||
ptt = 0
|
||||
if score >= 10000000:
|
||||
ptt += 2
|
||||
elif score >= 9800000:
|
||||
ptt += 1 + (score - 9800000) / 200000
|
||||
else:
|
||||
ptt += (score - 9500000) / 300000
|
||||
await msg.finish([Plain(rating + ptt)])
|
||||
|
|
|
@ -329,13 +329,13 @@ async def _(msg: Bot.MessageSession, level: str, goal: str, username: str = None
|
|||
if goal.upper() not in goal_list:
|
||||
await msg.finish(msg.locale.t("maimai.message.process.error.goal_invalid"))
|
||||
|
||||
output, songs = await get_level_process(msg, payload, level, goal)
|
||||
output, get_img = await get_level_process(msg, payload, level, goal)
|
||||
|
||||
if songs <= 10 or songs >= 50:
|
||||
await msg.finish(output.strip())
|
||||
else:
|
||||
if get_img:
|
||||
img = await msgchain2image([Plain(output)])
|
||||
await msg.finish([BImage(img)])
|
||||
else:
|
||||
await msg.finish(output.strip())
|
||||
|
||||
|
||||
@mai.handle('rank [<username>] {{maimai.help.rank}}')
|
||||
|
@ -359,15 +359,13 @@ async def _(msg: Bot.MessageSession, level: str, username: str = None):
|
|||
await msg.finish(msg.locale.t("maimai.message.no_username"))
|
||||
payload = {'username': username}
|
||||
|
||||
res, output = await get_score_list(msg, payload, level)
|
||||
res, get_img = await get_score_list(msg, payload, level)
|
||||
|
||||
if output == 0:
|
||||
await msg.finish(msg.locale.t("maimai.message.chart_not_found"))
|
||||
if output <= 10:
|
||||
await msg.finish([Plain(res.strip())])
|
||||
else:
|
||||
if get_img:
|
||||
img = await msgchain2image([Plain(res)])
|
||||
await msg.finish([BImage(img)])
|
||||
else:
|
||||
await msg.finish([Plain(res.strip())])
|
||||
|
||||
|
||||
@mai.handle('random <diff+level> [<dx_type>] {{maimai.help.random.filter}}')
|
||||
|
|
|
@ -208,6 +208,7 @@ async def get_level_process(msg, payload, process, goal):
|
|||
songs.append([music.id, music.title, diffs[song[1]], music.ds[song[1]], song[1], music.type])
|
||||
|
||||
output = ''
|
||||
get_img = False
|
||||
if len(song_remain) > 0:
|
||||
if len(song_remain) < 50: # 若剩余歌曲小于50个则显示
|
||||
song_record = [[s['id'], s['level_index']] for s in verlist]
|
||||
|
@ -225,12 +226,14 @@ async def get_level_process(msg, payload, process, goal):
|
|||
if verlist[record_index]['fs']:
|
||||
self_record = syncRank[sync_rank.index(verlist[record_index]['fs'])]
|
||||
output += f"{s[0]}\u200B. {s[1]}{' (DX)' if s[5] == 'DX' else ''} {s[2]} {s[3]} {self_record}\n"
|
||||
if len(song_remain) > 10: # 若剩余歌曲大于10个则使用图片形式
|
||||
get_img = True
|
||||
else:
|
||||
output = f"{msg.locale.t('maimai.message.process', song_remain=len(song_remain), process=process, goal=goal)}"
|
||||
await msg.finish(msg.locale.t('maimai.message.process', song_remain=len(song_remain), process=process, goal=goal))
|
||||
else:
|
||||
output = f"{msg.locale.t('maimai.message.process.completed', process=process, goal=goal)}"
|
||||
await msg.finish(msg.locale.t('maimai.message.process.completed', process=process, goal=goal))
|
||||
|
||||
return output, len(song_remain)
|
||||
return output, get_img
|
||||
|
||||
|
||||
async def get_score_list(msg, payload, level):
|
||||
|
@ -257,10 +260,15 @@ async def get_score_list(msg, payload, level):
|
|||
output_lines.append(output)
|
||||
|
||||
outputs = '\n'.join(output_lines)
|
||||
|
||||
res = f"{msg.locale.t('maimai.message.scorelist', user=username, level=level)}\n{outputs}"
|
||||
get_img = False
|
||||
|
||||
return res, len(output_lines)
|
||||
if len(output_lines) == 0:
|
||||
await msg.finish(msg.locale.t("maimai.message.chart_not_found"))
|
||||
elif len(output_lines) > 10:
|
||||
get_img = True
|
||||
|
||||
return res, get_img
|
||||
|
||||
|
||||
async def get_plate_process(msg, payload, plate):
|
||||
|
|
|
@ -233,10 +233,10 @@ async def _(msg: Bot.MessageSession):
|
|||
if goal.upper() not in goal_list:
|
||||
await msg.finish(msg.locale.t("maimai.message.process.error.goal_invalid"))
|
||||
|
||||
output, songs = await get_level_process(msg, payload, level, goal)
|
||||
output, get_img = await get_level_process(msg, payload, level, goal)
|
||||
|
||||
if songs <= 10 or songs >= 50:
|
||||
await msg.finish(output.strip())
|
||||
else:
|
||||
if get_img:
|
||||
img = await msgchain2image([Plain(output)])
|
||||
await msg.finish([BImage(img)])
|
||||
else:
|
||||
await msg.finish(output.strip())
|
Reference in a new issue