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/dictionary/__init__.py
多羅狼 c69c12a5b0
4x
2023-03-02 19:43:54 +08:00

23 lines
1.2 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.

from core.builtins import Bot, Image, Plain
from core.component import on_command
from core.utils.i18n import get_target_locale
from .screenshot import get_pic
dict_module = on_command('dictionary', alias=["dict"],
desc='{dictionary.desc}', developers=['Dianliang233'])
@dict_module.handle(help_doc='<term> {{diactionary.help}}')
async def _(msg: Bot.MessageSession):
print(str(msg.parsed_msg['<term>']).replace(' ', '-').lower())
pic_collins = await get_pic(
'https://www.collinsdictionary.com/dictionary/english/' + str(msg.parsed_msg['<term>']).replace(' ',
'-').lower(),
'collins')
# pic_yd = await get_pic('https://www.youdao.com/result?word=' + msg.parsed_msg['<term>'] + '&lang=en', 'yd')
# if pic_collins or pic_yd:
if pic_collins:
# await msg.finish([Image(pic_collins), Image(pic_yd),
await msg.finish([Image(pic_collins), Plain(
f'https://www.collinsdictionary.com/dictionary/english/{msg.parsed_msg["<term>"]}')])
# 有道https://www.youdao.com/result?lang=en&word={msg.parsed_msg["<term>"]}'''])