Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/b30/__init__.py
2021-09-05 02:08:00 +08:00

30 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from core.elements import MessageSession, Plain, Image
from core.loader.decorator import command
from .getb30 import getb30
from .initialize import arcb30init
@command('b30', help_doc='~b30 <friendcode>')
async def main(msg: MessageSession):
assets = os.path.abspath('assets/arcaea')
friendcode = msg.parsed_msg['<friendcode>']
if friendcode:
if friendcode == 'initialize':
if msg.checkSuperUser():
await arcb30init(msg)
else:
await msg.sendMessage('权限不足')
return
else:
if not os.path.exists(assets):
resp = {'text': '未找到资源文件请放置一枚arcaea的apk到机器人的assets目录并重命名为arc.apk后使用~b30 initialize初始化资源。'}
else:
resp = await getb30(friendcode)
else:
resp = {'text': '请输入好友码!'}
msgchain = [Plain(resp['text'])]
if 'file' in resp and msg.Feature.image:
msgchain.append(Image(path=resp['file']))
await msg.sendMessage(msgchain)