mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 06:32:47 +00:00
diss 修改 api
This commit is contained in:
parent
f9ec8e5083
commit
1770c44e7c
33
diss.py
33
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()
|
||||
|
Loading…
Reference in New Issue
Block a user