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
2023-06-04 21:03:24 +08:00

21 lines
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.

from core.builtins import Bot, Image, Plain
from core.component import module
from .screenshot import get_pic
dict_module = module('dictionary', alias="dict",
desc='{dictionary.help.desc}', developers=['Dianliang233'], support_languages=['en_us'])
@dict_module.handle(help_doc='<term> {{dictionary.help}}')
async def _(msg: Bot.MessageSession, term: str):
pic_collins = await get_pic(
'https://www.collinsdictionary.com/dictionary/english/' + str(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/{term}')])
# 有道https://www.youdao.com/result?lang=en&word={msg.parsed_msg["<term>"]}'''])