From 1770c44e7c120a594fddaa8190d1c654bc02d128 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sat, 8 Jan 2022 22:46:16 +0800 Subject: [PATCH] =?UTF-8?q?diss=20=E4=BF=AE=E6=94=B9=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diss.py | 33 ++++++++++++--------------------- list.json | 4 ++-- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/diss.py b/diss.py index b9f94e6..b2600fa 100644 --- a/diss.py +++ b/diss.py @@ -1,44 +1,35 @@ -from time import sleep -from requests import get +from asyncio import sleep from pagermaid.listener import listener -from pagermaid.utils import alias_command +from pagermaid.utils import alias_command, get @listener(is_plugin=True, outgoing=True, command=alias_command("diss"), description="儒雅随和版祖安语录。") async def diss(context): await context.edit("获取中 . . .") - status = False for _ in range(20): # 最多尝试20次 - req = get("https://nmsl.shadiao.app/api.php?level=min&from=tntcrafthim") + req = await get("https://xtaolabs.com/api/diss/?level=min&from=tntcrafthim") if req.status_code == 200: res = req.text - await context.edit(res, parse_mode='html', link_preview=False) - status = True - break + return await context.edit(res, parse_mode='html', link_preview=False) else: continue - if status == False: - await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") - sleep(2) - await context.delete() + await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") + await sleep(2) + await context.delete() @listener(is_plugin=True, outgoing=True, command=alias_command("biss"), description="加带力度版祖安语录。") async def biss(context): await context.edit("获取中 . . .") - status = False for _ in range(20): # 最多尝试20次 - req = get("https://nmsl.shadiao.app/api.php?from=tntcrafthim") + req = await get("https://xtaolabs.com/api/diss/?from=tntcrafthim") if req.status_code == 200: res = req.text - await context.edit(res, parse_mode='html', link_preview=False) - status = True - break + return await context.edit(res, parse_mode='html', link_preview=False) else: continue - if status == False: - await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") - sleep(2) - await context.delete() + await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") + await sleep(2) + await context.delete() diff --git a/list.json b/list.json index 89ad486..464e3d6 100644 --- a/list.json +++ b/list.json @@ -242,10 +242,10 @@ }, { "name": "diss", - "version": "1.11", + "version": "1.111", "section": "chat", "maintainer": "TNTcraftHIM", - "size": "1.5 kb", + "size": "1.4 kb", "supported": true, "des-short": "祖安对线语录", "des": "让你在祖安大舞台能够时而儒雅,时而火力全开的对线。命令:diss,biss。"