mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-23 00:52:26 +00:00
ACGM,COSM,MEIZI插件全部更新失败重试与多线程支持!
This commit is contained in:
parent
3373703e2a
commit
e129d7932c
15
acg-multi.py
15
acg-multi.py
@ -12,7 +12,9 @@ async def joke(context):
|
|||||||
await context.edit("获取中 . . .")
|
await context.edit("获取中 . . .")
|
||||||
status = False
|
status = False
|
||||||
for _ in range (20): #最多重试20次
|
for _ in range (20): #最多重试20次
|
||||||
website = random.randint(0, 5)
|
website = random.randint(0, 6)
|
||||||
|
filename = str(random.random()) + ".png"
|
||||||
|
try:
|
||||||
if website == 0:
|
if website == 0:
|
||||||
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
|
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
|
||||||
elif website == 1:
|
elif website == 1:
|
||||||
@ -33,22 +35,23 @@ async def joke(context):
|
|||||||
img = requests.get(img)
|
img = requests.get(img)
|
||||||
if img.status_code != 200:
|
if img.status_code != 200:
|
||||||
continue #如果返回不正常就赶紧下一回
|
continue #如果返回不正常就赶紧下一回
|
||||||
with open(r'tu.png', 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
await context.edit("正在上传图片")
|
await context.edit("上传中 . . .")
|
||||||
f.write(img.content)
|
f.write(img.content)
|
||||||
await context.client.send_file(
|
await context.client.send_file(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
"tu.png",
|
filename,
|
||||||
reply_to=None,
|
reply_to=None,
|
||||||
caption=None
|
caption=None
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
remove('tu.png')
|
remove(filename)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
status = True
|
status = True
|
||||||
break #成功了就赶紧结束啦!
|
break #成功了就赶紧结束啦!
|
||||||
|
except:
|
||||||
|
continue
|
||||||
if not status:
|
if not status:
|
||||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from random import randint
|
from random import randint, random
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from requests import get
|
from requests import get
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
@ -12,6 +12,8 @@ async def joke(context):
|
|||||||
status = False
|
status = False
|
||||||
for _ in range (20): #最多重试20次
|
for _ in range (20): #最多重试20次
|
||||||
website = randint(0, 6)
|
website = randint(0, 6)
|
||||||
|
filename = str(random()) + ".png"
|
||||||
|
try:
|
||||||
if website == 0:
|
if website == 0:
|
||||||
img = get("https://api.helloworld.la/xiezhen_cosplay.php")
|
img = get("https://api.helloworld.la/xiezhen_cosplay.php")
|
||||||
elif website == 1:
|
elif website == 1:
|
||||||
@ -31,22 +33,23 @@ async def joke(context):
|
|||||||
img = get(img.content)
|
img = get(img.content)
|
||||||
if img.status_code != 200:
|
if img.status_code != 200:
|
||||||
continue #再试一次
|
continue #再试一次
|
||||||
with open(r'tu.png', 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
await context.edit("正在上传图片")
|
await context.edit("上传中 . . .")
|
||||||
f.write(img.content)
|
f.write(img.content)
|
||||||
await context.client.send_file(
|
await context.client.send_file(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
"tu.png",
|
filename,
|
||||||
reply_to=None,
|
reply_to=None,
|
||||||
caption=None
|
caption=None
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
remove('tu.png')
|
remove(filename)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
status = True
|
status = True
|
||||||
break #成功了就赶紧结束啦!
|
break #成功了就赶紧结束啦!
|
||||||
|
except:
|
||||||
|
continue
|
||||||
if not status:
|
if not status:
|
||||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||||
sleep(2)
|
sleep(2)
|
||||||
|
18
list.json
18
list.json
@ -212,30 +212,30 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "cosplay-multi",
|
"name": "cosplay-multi",
|
||||||
"version": "1.1",
|
"version": "1.2",
|
||||||
"section": "profile",
|
"section": "daily",
|
||||||
"maintainer": "TNTcraftHIM",
|
"maintainer": "TNTcraftHIM",
|
||||||
"size": "2.0 kb",
|
"size": "2.2 kb",
|
||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "多网站随机获取Cos图",
|
"des-short": "多网站随机获取Cos图",
|
||||||
"des": "在不同的几个网站中随机获取Cosplay图片,解决了cosplay单个API流量用尽后无法获取的问题。命令:cosm。"
|
"des": "在不同的几个网站中随机获取Cosplay图片,解决了cosplay单个API流量用尽后无法获取的问题。命令:cosm。"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "meizi",
|
"name": "meizi",
|
||||||
"version": "1.5",
|
"version": "1.6",
|
||||||
"section": "profile",
|
"section": "daily",
|
||||||
"maintainer": "TNTcraftHIM",
|
"maintainer": "TNTcraftHIM",
|
||||||
"size": "3.7 kb",
|
"size": "4.0 kb",
|
||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "多网站随机获取写真",
|
"des-short": "多网站随机获取写真",
|
||||||
"des": "从不同的网站中调取妹子写真/视频,但是无漏点,放心使用(安全版ghs)。命令:mz,sp。"
|
"des": "从不同的网站中调取妹子写真/视频,但是无漏点,放心使用(安全版ghs)。命令:mz,sp。"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "acg-multi",
|
"name": "acg-multi",
|
||||||
"version": "1.2",
|
"version": "1.3",
|
||||||
"section": "profile",
|
"section": "daily",
|
||||||
"maintainer": "TNTcraftHIM",
|
"maintainer": "TNTcraftHIM",
|
||||||
"size": "2.3 kb",
|
"size": "2.5 kb",
|
||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "多网站随机获取ACG图",
|
"des-short": "多网站随机获取ACG图",
|
||||||
"des": "从几个不同的图库中随机获取二刺螈(bushi)ACG图片,基本都是手机尺寸的图。命令:acgm。"
|
"des": "从几个不同的图库中随机获取二刺螈(bushi)ACG图片,基本都是手机尺寸的图。命令:acgm。"
|
||||||
|
22
meizi.py
22
meizi.py
@ -12,6 +12,8 @@ async def mz(context):
|
|||||||
status = False
|
status = False
|
||||||
for _ in range (20): #最多重试20次
|
for _ in range (20): #最多重试20次
|
||||||
website = random.randint(0, 13)
|
website = random.randint(0, 13)
|
||||||
|
filename = str(random.random()) + ".png"
|
||||||
|
try:
|
||||||
if website == 0:
|
if website == 0:
|
||||||
img = get("https://mm.52.mk/img")
|
img = get("https://mm.52.mk/img")
|
||||||
elif website == 1:
|
elif website == 1:
|
||||||
@ -41,22 +43,23 @@ async def mz(context):
|
|||||||
elif website == 13:
|
elif website == 13:
|
||||||
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
|
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
|
||||||
if img.status_code == 200:
|
if img.status_code == 200:
|
||||||
with open(r'tu.png', 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
await context.edit("正在上传图片")
|
await context.edit("上传中 . . .")
|
||||||
f.write(img.content)
|
f.write(img.content)
|
||||||
await context.client.send_file(
|
await context.client.send_file(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
"tu.png",
|
filename,
|
||||||
reply_to=None,
|
reply_to=None,
|
||||||
caption=None
|
caption=None
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
remove('tu.png')
|
remove(filename)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
status = True
|
status = True
|
||||||
break #成功了就赶紧结束啦!
|
break #成功了就赶紧结束啦!
|
||||||
|
except:
|
||||||
|
continue
|
||||||
if not status:
|
if not status:
|
||||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子看啦!) 。")
|
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子看啦!) 。")
|
||||||
sleep(2)
|
sleep(2)
|
||||||
@ -69,18 +72,19 @@ async def sp(context):
|
|||||||
status = False
|
status = False
|
||||||
for _ in range (20): #最多重试20次
|
for _ in range (20): #最多重试20次
|
||||||
vid = get("https://mv.52.mk/video.php")
|
vid = get("https://mv.52.mk/video.php")
|
||||||
|
filename = str(random.random()) + ".mp4"
|
||||||
if vid.status_code == 200:
|
if vid.status_code == 200:
|
||||||
with open(r'vid.mp4', 'wb') as f:
|
with open(filename, 'wb') as f:
|
||||||
await context.edit("正在上传视频")
|
await context.edit("上传中 . . .")
|
||||||
f.write(vid.content)
|
f.write(vid.content)
|
||||||
await context.client.send_file(
|
await context.client.send_file(
|
||||||
context.chat_id,
|
context.chat_id,
|
||||||
"vid.mp4",
|
filename,
|
||||||
reply_to=None,
|
reply_to=None,
|
||||||
caption=None
|
caption=None
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
remove('vid.mp4')
|
remove(filename)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
status = True
|
status = True
|
||||||
|
Loading…
Reference in New Issue
Block a user