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/lang/__init__.py

21 lines
756 B
Python
Raw Normal View History

2021-08-02 07:32:16 +00:00
from core.elements import MessageSession
from core.i18n import BotI18n
2021-08-07 07:56:48 +00:00
from core.loader.decorator import command
2021-08-02 07:32:16 +00:00
@command('lang', ('i18n', 'language', 'languages'), (
2021-08-07 07:56:48 +00:00
'~lang {获取当前语言}',
'~lang set <target> {设置群组使用语言}',
'~lang get <string> {获取指定字符串}'),
need_admin=True, is_base_function=True
)
2021-08-02 07:32:16 +00:00
async def lang(msg: MessageSession):
i18n = BotI18n(msg)
2021-08-02 09:29:44 +00:00
if msg.parsed_msg is None:
await msg.sendMessage(i18n.uselang)
elif msg.parsed_msg['set']:
i18n.set_language(msg.parsed_msg['<target>'])
2021-08-02 07:32:16 +00:00
await msg.sendMessage('设置成功。')
elif msg.parsed_msg['get']:
2021-08-02 09:29:44 +00:00
await msg.sendMessage(i18n.get_string(msg.parsed_msg['<string>']))