2023-03-20 13:41:21 +00:00
|
|
|
import urllib.parse
|
|
|
|
|
|
|
|
from pagermaid.listener import listener
|
|
|
|
from pagermaid.enums import Message
|
|
|
|
from pagermaid.utils import lang
|
|
|
|
|
2023-04-13 14:03:35 +00:00
|
|
|
ju_pai_api = "https://api.txqq.pro/api/zt.php"
|
2023-03-20 13:41:21 +00:00
|
|
|
|
|
|
|
|
2023-07-01 12:18:58 +00:00
|
|
|
@listener(command="jupai", description="生成举牌小人", parameters="[text/reply]")
|
2023-03-20 13:41:21 +00:00
|
|
|
async def ju_pai(message: Message):
|
|
|
|
text = message.obtain_message()
|
|
|
|
if not text:
|
2023-07-01 12:18:58 +00:00
|
|
|
return await message.edit(lang("arg_error"))
|
2023-03-20 13:41:21 +00:00
|
|
|
try:
|
|
|
|
image_url = f"{ju_pai_api}?msg={urllib.parse.quote(text)}"
|
|
|
|
await message.reply_photo(
|
|
|
|
image_url,
|
|
|
|
quote=False,
|
2024-02-04 07:56:06 +00:00
|
|
|
reply_to_message_id=message.reply_to_message_id,
|
|
|
|
message_thread_id=message.message_thread_id,
|
2023-03-20 13:41:21 +00:00
|
|
|
)
|
|
|
|
await message.safe_delete()
|
|
|
|
except Exception as e:
|
|
|
|
await message.edit(f"获取失败 ~ {e.__class__.__name__}")
|