mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 07:47:39 +00:00
acgm cosm meizi 三插件多线程优化(更快乐了) (#63)
Co-authored-by: TNTcraftHIM <TNTcraftHIM@users.noreply.github.com>
This commit is contained in:
parent
6a31b7dde1
commit
a73f5eeef4
39
acg-multi.py
39
acg-multi.py
@ -13,7 +13,7 @@ async def joke(context):
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = random.randint(0, 6)
|
||||
filename = str(random.random()) + ".png"
|
||||
filename = "acgm" + str(random.random())[2:] + ".png"
|
||||
try:
|
||||
if website == 0:
|
||||
img = requests.get("http://api.btstu.cn/sjbz/?lx=m_dongman")
|
||||
@ -36,23 +36,32 @@ async def joke(context):
|
||||
if img.status_code != 200:
|
||||
continue #如果返回不正常就赶紧下一回
|
||||
with open(filename, 'wb') as f:
|
||||
await context.edit("上传中 . . .")
|
||||
f.write(img.content)
|
||||
await context.client.send_file(
|
||||
context.chat_id,
|
||||
filename,
|
||||
reply_to=None,
|
||||
caption=None
|
||||
)
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
continue
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
@ -12,7 +12,7 @@ async def joke(context):
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = randint(0, 6)
|
||||
filename = str(random()) + ".png"
|
||||
filename = "cosm" + str(random())[2:] + ".png"
|
||||
try:
|
||||
if website == 0:
|
||||
img = get("https://api.helloworld.la/xiezhen_cosplay.php")
|
||||
@ -34,23 +34,32 @@ async def joke(context):
|
||||
if img.status_code != 200:
|
||||
continue #再试一次
|
||||
with open(filename, 'wb') as f:
|
||||
await context.edit("上传中 . . .")
|
||||
f.write(img.content)
|
||||
await context.client.send_file(
|
||||
context.chat_id,
|
||||
filename,
|
||||
reply_to=None,
|
||||
caption=None
|
||||
)
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
continue
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器 。")
|
||||
|
10
list.json
10
list.json
@ -212,17 +212,17 @@
|
||||
},
|
||||
{
|
||||
"name": "cosplay-multi",
|
||||
"version": "1.2",
|
||||
"version": "1.3",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.2 kb",
|
||||
"size": "2.4 kb",
|
||||
"supported": true,
|
||||
"des-short": "多网站随机获取Cos图",
|
||||
"des": "在不同的几个网站中随机获取Cosplay图片,解决了cosplay单个API流量用尽后无法获取的问题。命令:cosm。"
|
||||
},
|
||||
{
|
||||
"name": "meizi",
|
||||
"version": "1.6",
|
||||
"version": "1.7",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "4.0 kb",
|
||||
@ -232,10 +232,10 @@
|
||||
},
|
||||
{
|
||||
"name": "acg-multi",
|
||||
"version": "1.3",
|
||||
"version": "1.4",
|
||||
"section": "daily",
|
||||
"maintainer": "TNTcraftHIM",
|
||||
"size": "2.5 kb",
|
||||
"size": "2.4 kb",
|
||||
"supported": true,
|
||||
"des-short": "多网站随机获取ACG图",
|
||||
"des": "从几个不同的图库中随机获取二刺螈(bushi)ACG图片,基本都是手机尺寸的图。命令:acgm。"
|
||||
|
76
meizi.py
76
meizi.py
@ -12,7 +12,7 @@ async def mz(context):
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
website = random.randint(0, 13)
|
||||
filename = str(random.random()) + ".png"
|
||||
filename = "mz" + str(random.random())[2:] + ".png"
|
||||
try:
|
||||
if website == 0:
|
||||
img = get("https://mm.52.mk/img")
|
||||
@ -44,26 +44,27 @@ async def mz(context):
|
||||
img = get("https://uploadbeta.com/api/pictures/random/?key=%E6%80%A7%E6%84%9F")
|
||||
if img.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
await context.edit("上传中 . . .")
|
||||
f.write(img.content)
|
||||
await context.client.send_file(
|
||||
context.chat_id,
|
||||
filename,
|
||||
reply_to=None,
|
||||
caption=None
|
||||
)
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
await context.edit("上传中 . . .")
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
continue
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子看啦!) 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子看啦!) 。")
|
||||
|
||||
@listener(is_plugin=True, outgoing=True, command="sp",
|
||||
description="随机获取妹子的视频")
|
||||
@ -71,26 +72,37 @@ async def sp(context):
|
||||
await context.edit("获取中 . . .")
|
||||
status = False
|
||||
for _ in range (20): #最多重试20次
|
||||
vid = get("https://mv.52.mk/video.php")
|
||||
filename = str(random.random()) + ".mp4"
|
||||
if vid.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
try:
|
||||
vid = get("https://mv.52.mk/video.php")
|
||||
filename = "sp" + str(random.random())[2:] + ".mp4"
|
||||
if vid.status_code == 200:
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(vid.content)
|
||||
await context.edit("上传中 . . .")
|
||||
f.write(vid.content)
|
||||
await context.client.send_file(
|
||||
context.chat_id,
|
||||
filename,
|
||||
reply_to=None,
|
||||
caption=None
|
||||
)
|
||||
await context.client.send_file(context.chat_id,filename)
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
except:
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
status = True
|
||||
break #成功了就赶紧结束啦!
|
||||
|
||||
continue
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
if not status:
|
||||
await context.edit("出错了呜呜呜 ~ 试了好多好多次都无法访问到 API 服务器(没有妹子视频看啦!) 。")
|
||||
sleep(2)
|
||||
await context.delete()
|
||||
try:
|
||||
remove(filename)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
await context.delete()
|
||||
except:
|
||||
pass
|
||||
await context.client.send_message(context.chat_id,"出错了呜呜呜 ~ 试了好多好多次都无法访问到服务器(没有妹子视频看啦!) 。")
|
Loading…
Reference in New Issue
Block a user