diss 修改 api

This commit is contained in:
xtaodada 2022-01-08 22:46:16 +08:00
parent f9ec8e5083
commit 1770c44e7c
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 14 additions and 23 deletions

25
diss.py
View File

@ -1,26 +1,21 @@
from time import sleep from asyncio import sleep
from requests import get
from pagermaid.listener import listener 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"), @listener(is_plugin=True, outgoing=True, command=alias_command("diss"),
description="儒雅随和版祖安语录。") description="儒雅随和版祖安语录。")
async def diss(context): async def diss(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False
for _ in range(20): # 最多尝试20次 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: if req.status_code == 200:
res = req.text res = req.text
await context.edit(res, parse_mode='html', link_preview=False) return await context.edit(res, parse_mode='html', link_preview=False)
status = True
break
else: else:
continue continue
if status == False:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2) await sleep(2)
await context.delete() await context.delete()
@ -28,17 +23,13 @@ async def diss(context):
description="加带力度版祖安语录。") description="加带力度版祖安语录。")
async def biss(context): async def biss(context):
await context.edit("获取中 . . .") await context.edit("获取中 . . .")
status = False
for _ in range(20): # 最多尝试20次 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: if req.status_code == 200:
res = req.text res = req.text
await context.edit(res, parse_mode='html', link_preview=False) return await context.edit(res, parse_mode='html', link_preview=False)
status = True
break
else: else:
continue continue
if status == False:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。") await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2) await sleep(2)
await context.delete() await context.delete()

View File

@ -242,10 +242,10 @@
}, },
{ {
"name": "diss", "name": "diss",
"version": "1.11", "version": "1.111",
"section": "chat", "section": "chat",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "1.5 kb", "size": "1.4 kb",
"supported": true, "supported": true,
"des-short": "祖安对线语录", "des-short": "祖安对线语录",
"des": "让你在祖安大舞台能够时而儒雅时而火力全开的对线。命令dissbiss。" "des": "让你在祖安大舞台能够时而儒雅时而火力全开的对线。命令dissbiss。"