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