Archived
1
0
Fork 0

Restore partial function

This commit is contained in:
多羅狼 2023-04-28 19:47:14 +08:00 committed by GitHub
parent 2c63bc983b
commit 9ce77f276e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,4 +12,46 @@ assets_path = os.path.abspath('./assets/')
@arc.handle()
@arc.handle('<no_one_cares>')
async def _(msg: Bot.MessageSession):
await msg.finish([Image(assets_path + '/noc.jpg'), Image(assets_path + '/aof.jpg')])
await msg.finish([msg.locale.t("arcaea.message.sb616", Image(assets_path + '/noc.jpg'), Image(assets_path + '/aof.jpg')])
@arc.command('download {{arcaea.download.help}}')
async def _(msg: Bot.MessageSession):
if not webrender:
await msg.finish([message.no_webrender")])
resp = await get_url(webrender + 'source?url=https://webapi.lowiro.com/webapi/serve/static/bin/arcaea/apk/', 200,
fmt='json')
if resp:
await msg.finish([Plain(msg.locale.t("arcaea.download.message.success", version=resp["value"]["version"],
url=resp['value']['url']))])
@arc.command('random {{arcaea.random.help}}')
async def _(msg: Bot.MessageSession):
if not webrender:
await msg.finish([msg.locale.t("arcaea.message.no_webrender")])
resp = await get_url(webrender + 'source?url=https://webapi.lowiro.com/webapi/song/showcase/', 200, fmt='json')
if resp:
value = resp["value"][0]
image = f'{assets_path}/jacket/{value["song_id"]}.jpg'
result = [Plain(value["title"]["en"])]
if os.path.exists(image):
result.append(Image(path=image))
await msg.finish(result)
@arc.command('rank free {{arcaea.rank.help.free}}', 'rank paid {{arcaea.rank.help.paid}}')
async def _(msg: Bot.MessageSession):
if not webrender:
await msg.finish([.no_webrender")])
if msg.parsed_msg.get('free', False):
resp = await get_url(webrender + 'source?url=https://webapi.lowiro.com/webapi/song/rank/free/', 200, fmt='json')
else:
resp = await get_url(webrender + 'source?url=https://webapi.lowiro.com/webapi/song/rank/paid/', 200, fmt='json')
if resp:
r = []
rank = 0
for x in resp['value']:
rank += 1
r.append(f'{rank}. {x["title"]["en"]} ({x["status"]})')
await msg.finish('\n'.join(r))