diff --git a/plugins/genshin/hilichurls.py b/plugins/genshin/hilichurls.py new file mode 100644 index 00000000..08177b4c --- /dev/null +++ b/plugins/genshin/hilichurls.py @@ -0,0 +1,52 @@ +import json +from os import sep + +from telegram import Update +from telegram.ext import CommandHandler, CallbackContext, filters + +from logger import Log +from plugins.base import BasePlugins +from utils.bot import get_all_args +from utils.decorators.error import error_callable +from utils.decorators.restricts import restricts +from utils.plugins.manager import listener_plugins_class + + +@listener_plugins_class() +class Hilichurls(BasePlugins): + + def __init__(self): + """加载数据文件.数据整理自 https://wiki.biligame.com/ys By @zhxycn.""" + with open(f"resources{sep}json{sep}hilichurls_dictionary.json", "r", encoding="utf8") as f: + self.hilichurls_dictionary = json.load(f) + + @classmethod + def create_handlers(cls): + hilichurls = cls() + return [CommandHandler('hilichurls', hilichurls.command_start)] + + @error_callable + @restricts() + async def command_start(self, update: Update, context: CallbackContext) -> None: + """丘丘语字典.""" + message = update.message + user = update.effective_user + args = get_all_args(context) + if len(args) >= 1: + msg = args[0] + else: + reply_message = await message.reply_text("请输入要查询的丘丘语。") + if filters.ChatType.GROUPS.filter(reply_message): + self._add_delete_message_job(context, message.chat_id, message.message_id) + self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id) + return + search = str.casefold(msg) # 忽略大小写以方便查询 + if search not in self.hilichurls_dictionary: + reply_message = await message.reply_text(f"在丘丘语字典中未找到 {msg}。") + if filters.ChatType.GROUPS.filter(reply_message): + self._add_delete_message_job(context, message.chat_id, message.message_id) + self._add_delete_message_job(context, reply_message.chat_id, reply_message.message_id) + return + Log.info(f"用户 {user.full_name}[{user.id}] 查询丘丘语字典命令请求 || 参数 {msg}") + result = self.hilichurls_dictionary[f"{search}"] + await message.reply_markdown_v2(f"丘丘语: `{search}`\n\n`{result}`") diff --git a/resources/json/hilichurls_dictionary.json b/resources/json/hilichurls_dictionary.json new file mode 100644 index 00000000..7cd43ce6 --- /dev/null +++ b/resources/json/hilichurls_dictionary.json @@ -0,0 +1,84 @@ +{ + "aba": "[名] 食物;东西。", + "adam": "[动] 生气。", + + "beru": "[动] 帮助。\n[例句] Yo mimi beru si?", + "biadam": "[副] 生气地。", + "biat": "[动] 草。几乎只见于粗口话。", + "biat ye": "[短] Fk you。此短语堪称经典,是丘丘语中最有代表性的粗口话。", + "biodomu": "[副] 客气地;恭恭敬敬地。与词组ya odomu相对。\n[例句] Mani nini Biodomu!", + "buka": "[名] 肚子。\n[例句] Todo yo, buka guruguru nye.", + + "celi": "[副] 一天;整天。\n[名] 天气。\n[名] 火;火元素。", + + "dada": "[官方][副] 最强。\n[动] 表示感谢。\n[助] 奥力给!(表确信或语势增强)", + "dala": "[名] 谁;某人。", + "dala si": "[短] 什么人?", + "domu": "[动] 躺下;躺着。", + + "eleka": "[动] 让;使;令。", + + "guru-guru": "[名][本义] 肚子饿时发出的咕噜咕噜声。\n[形][引申] 肚子饿。", + "gusha": "[官方][名][本义] 草、谷物、蔬菜等可食用植物。\n[官方][形][引申] 倒霉。", + + "ika": "[名] 这个。", + + "ka": "[副] ……吗?用于句末,表示疑问或反问。可能与日语ka的用法相同。\n[例句] Yo mosi ka?", + "kucha": "[官方][形] 弱的;较弱的。", + "kundala": "[名] 垫底者;最弱的人。", + "kuzi": "[动] 觉得。", + + "lata": "[名][本义] 冰;冰元素。\n[动][引申] 下雪。", + "lata movo": "[名][动] 水;流动的冰。", + "lawa": "[名] 大哥;强者。(表示尊敬)", + + "mi": "[名] 我。", + "mani": "[动] 给;向……献上。\n[例句] Muhe vin plata? Mani ye! Mani dada!", + "mimi": "[名] 我们。Mi的简单复数形式。", + "mita": "[官方][名][本义] 肉。\n[官方][形][引申] 愉悦;心情好。", + "mosi": "[官方][动] 吃。", + "mosi gusha": "[官方][短][本义] 吃植物。\n[官方][短][引申] 真倒霉;不开心。", + "mosi mita": "[官方][短][本义] 吃肉。\n[官方][短][引申] 幸运;愉快。", + "movo": "[动][本义] 打架。\n[动][引申] 跳舞。\n[动] 流动。\n[名] 风;风元素。", + "muhe": "[动] 想要。", + "muhe ye": "[短] 想要你。表示希望与对方产生互动,这种互动可以是积极的(如一起吃肉),也可以是消极的(如相约打架)。", + + "nini": "[名] 贡品。\n[名] 雷;雷元素。", + "nunu": "[官方][动][本义] 睡觉。\n[官方][动][引申] 晚安。", + "nye": "[名][形] 那个。", + + "olah":"[官方][助] 你好。", + "odomu": "[动] 客气。", + + "plata": "[动] 打。", + "pupu": "[名] 屁股。", + + "sada": "[动] 唱歌;念诗。\n[名] 岩;岩元素。", + "shato": "[名] 晴天。\n[动] 天晴。", + "si": "[副] 什么?(特殊疑问词)", + + "tiga": "[名] 丘丘;丘丘人。", + "tiga mitono": "[名] 丘丘人战士。", + "todo": "[动] 赠送。", + "tomo": "[动] 聚集。", + + "unta": "[动] 决定;裁判;裁决。", + "unu": "[名] 神;元素力量。(存疑)\n※此处存在一个巨大的问题,即第一义项与《丘丘人文化习俗考察》有出入:该书认为丘丘人没有“神”这一概念。该问题义项最初系纯粹基于《丘丘人诗歌选》推断得出,而《丘丘诗集》的成书时间(一测,2019年6月21日)比《文化研究》(二测,2020年3月19日)要早很多,编撰本词条时《文化研究》尚未问世。据@黑 暗 骑 士的说法,unu可能实际上指的是泛指的全体“元素”,而非具体某一个的“神”;该说法更加经得起推敲,但是在具体语境之中“元素”释义的表现力并不如“神”,因此本词典保留了“神”这一释义,并且特此声明。", + "upa": "[副][本义] 在……上面。\n[副][引申] 层层叠加;一个又一个。", + + "valo": "[助] 再见。", + "vin": "[动] 防止;阻止;免疫。", + "vin plata": "[名] 防打(人类语言中称为“盾牌”)。", + + "ya": "[副] 不;不是。(表否定)\n[动] 不要。(表拒绝)\n[助] 呀;啊。(表惊叹)", + "ya odomu": "[短] 别客气。", + "yaya": "[动] 尝试。", + "yaya ika": "[短] 尝尝这个!(take this)", + "ye": "[名] 你。", + "yeye": "[名] 你们。Ye的简单复数形式。", + "yika": "[名] 坏东西。", + "yo": "[名] 您。Ye的尊称。", + "yoyo": "[名][本义] 酒。\n[动][引申] 喝酒。", + + "zido": "[形] 好。" +}