commit 764d4d42ce8865f50d1ba547552e0a8735e739bf Author: xtaodada Date: Fri Feb 11 18:03:27 2022 +0800 🎉 Begin a project. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e8b8ce --- /dev/null +++ b/.gitignore @@ -0,0 +1,136 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# IDE +.idea/ + +# C extensions +*.so +*/desktop.files.json + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# vscode +.vscode/ diff --git a/list.json b/list.json new file mode 100644 index 0000000..5e82a8b --- /dev/null +++ b/list.json @@ -0,0 +1,14 @@ +{ + "list": [ + { + "name": "xtao-some", + "version": "1.0", + "section": "daily", + "maintainer": "xtaodada", + "size": "12.9 kb", + "supported": true, + "des-short": "一大堆便民功能。", + "des": "超多功能 例如 -ip" + } + ] +} diff --git a/xtao-some.py b/xtao-some.py new file mode 100644 index 0000000..33d8239 --- /dev/null +++ b/xtao-some.py @@ -0,0 +1,34 @@ +import json + +from pyrogram import Client + +from pagermaid.listener import listener +from pagermaid.utils import alias_command, Message, edit_or_reply, client + + +@listener(is_plugin=True, outgoing=True, command=alias_command("guess"), + description="能不能好好说话? - 拼音首字母缩写释义工具(需要回复一句话)") +async def guess(c: Client, message: Message): + text = message.arguments + if not text: + return await edit_or_reply(message, "请先输入一个缩写。") + message = await edit_or_reply(message, "获取中 . . .") + + text = {'text': text} + guess_json = (await client.post("https://lab.magiconch.com/api/nbnhhsh/guess", json=text)).json() + guess_res = [] + if not len(guess_json) == 0: + for num in range(0, len(guess_json)): + guess_res1 = json.loads(json.dumps(guess_json[num])) + guess_res1_name = guess_res1['name'] + try: + guess_res1_ans = ", ".join(guess_res1['trans']) + except: + try: + guess_res1_ans = ", ".join(guess_res1['inputting']) + except: + guess_res1_ans = "尚未录入" + guess_res.extend(["词组:" + guess_res1_name + "\n释义:" + guess_res1_ans]) + await edit_or_reply(message, "\n\n".join(guess_res)) + else: + await edit_or_reply(message, "没有匹配到拼音首字母缩写")