PagerMaid_Plugins/diss.py
2020-08-24 17:09:56 +08:00

63 lines
2.1 KiB
Python

<<<<<<< HEAD
=======
from time import sleep
>>>>>>> master
from requests import get
from pagermaid.listener import listener
@listener(is_plugin=True, outgoing=True, command="diss",
description="儒雅随和版祖安语录。")
async def diss(context):
await context.edit("获取中 . . .")
<<<<<<< HEAD
req = get("https://nmsl.shadiao.app/api.php?level=min&from=tnt")
if req.status_code == 200:
res = req.text
await context.edit(res, parse_mode='html', link_preview=False)
else:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
=======
status=False
for _ in range(20): #最多尝试20次
req = get("https://nmsl.shadiao.app/api.php?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
else:
continue
if status == False:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2)
await context.delete()
>>>>>>> master
@listener(is_plugin=True, outgoing=True, command="biss",
description="加带力度版祖安语录。")
async def biss(context):
await context.edit("获取中 . . .")
<<<<<<< HEAD
req = get("https://nmsl.shadiao.app/api.php?&from=tnt")
if req.status_code == 200:
res = req.text
await context.edit(res, parse_mode='html', link_preview=False)
else:
await context.edit("出错了呜呜呜 ~ 无法访问到 API 服务器 。")
=======
status=False
for _ in range(20): #最多尝试20次
req = get("https://nmsl.shadiao.app/api.php?from=tntcrafthim")
if req.status_code == 200:
res = req.text
await context.edit(res, parse_mode='html', link_preview=False)
status=True
break
else:
continue
if status == False:
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
sleep(2)
await context.delete()
>>>>>>> master