From d7648a23c1a75881db261375f83b994b9059d9e0 Mon Sep 17 00:00:00 2001 From: omg-xtao <100690902+omg-xtao@users.noreply.github.com> Date: Mon, 20 Mar 2023 21:41:21 +0800 Subject: [PATCH] =?UTF-8?q?jupai=20=E4=B8=BE=E7=89=8C=E5=B0=8F=E4=BA=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jupai/DES.md | 5 +++++ jupai/main.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 jupai/DES.md create mode 100644 jupai/main.py diff --git a/jupai/DES.md b/jupai/DES.md new file mode 100644 index 0000000..23be94d --- /dev/null +++ b/jupai/DES.md @@ -0,0 +1,5 @@ +# 举牌小人 + +``` +,jupai 123 +``` diff --git a/jupai/main.py b/jupai/main.py new file mode 100644 index 0000000..a23d58a --- /dev/null +++ b/jupai/main.py @@ -0,0 +1,28 @@ +import urllib.parse + +from pagermaid.listener import listener +from pagermaid.enums import Message +from pagermaid.utils import lang + +ju_pai_api = "https://juapi.org/api/zt.php" + + +@listener( + command="jupai", + description="生成举牌小人", + parameters="[text/reply]" +) +async def ju_pai(message: Message): + text = message.obtain_message() + if not text: + return await message.edit(lang('arg_error')) + try: + image_url = f"{ju_pai_api}?msg={urllib.parse.quote(text)}" + await message.reply_photo( + image_url, + quote=False, + reply_to_message_id=message.reply_to_message_id or message.reply_to_top_message_id, + ) + await message.safe_delete() + except Exception as e: + await message.edit(f"获取失败 ~ {e.__class__.__name__}")