mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-09 22:00:01 +08:00
first_commit .gitignore
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
from .qiu_translation import qiu_qiu_word_translation, qiu_qiu_phrase_translation
|
||||
from nonebot.adapters.cqhttp import Bot, MessageEvent
|
||||
from nonebot.typing import T_State
|
||||
from nonebot import on_command
|
||||
from util.utils import get_message_text
|
||||
from services.log import logger
|
||||
|
||||
|
||||
qiuqiu = on_command("丘丘语翻译", aliases={"丘丘一下", "丘丘翻译"}, priority=5, block=True)
|
||||
|
||||
suffix = "\n※ 只能从丘丘语翻译为中文,不能反向翻译\n" \
|
||||
"※ 注意空格,不要加入任何标点符号\n" \
|
||||
"※ 翻译数据来源于 米游社论坛"
|
||||
|
||||
|
||||
@qiuqiu.handle()
|
||||
async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
txt = get_message_text(event.json()).lower()
|
||||
if txt == "":
|
||||
return
|
||||
mes = qiu_qiu_phrase_translation(txt)
|
||||
if not mes:
|
||||
mes = qiu_qiu_word_translation(txt)
|
||||
mes += suffix
|
||||
# print(mes)
|
||||
await qiuqiu.send(mes, at_sender=True)
|
||||
logger.info(
|
||||
f"(USER {event.user_id}, GROUP {event.group_id if event.message_type != 'private' else 'private'})"
|
||||
f" 发送丘丘翻译:" + txt)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user