Merge pull request #22 from TNTcraftHIM/master

极大优化了meizi/acgm插件的API质量,增加上流社会对话工具插件
This commit is contained in:
Pentacene 2020-08-25 14:22:37 +08:00 committed by GitHub
commit 44777ab229
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 29 deletions

View File

@ -1,7 +1,7 @@
import json import json
from random import randint import random
import requests
from time import sleep from time import sleep
from requests import get
from pagermaid.listener import listener from pagermaid.listener import listener
from os import remove from os import remove
@ -12,32 +12,25 @@ 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 = randint(0, 9) website = random.randint(0, 5)
if website == 0: if website == 0:
img = 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:
img = get("https://acg.yanwz.cn/api.php") img = requests.get("https://acg.yanwz.cn/api.php")
elif website == 2: elif website == 2:
img = get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile") img = requests.get("https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302&device=mobile")
elif website == 3: elif website == 3:
img = get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman") img = requests.get("https://www.yunboys.cn/sjbz/api.php?method=mobile&lx=dongman")
elif website == 4: elif website == 4:
img = get("http://www.dmoe.cc/random.php") headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063','Referer':'https://osk.soloop.ooo/give_me_eropics-l/'}
img = requests.get("https://osk.soloop.ooo/rdm.php?"+ str(random.random()), headers=headers)
elif website == 5: elif website == 5:
img = get("https://api.vvhan.com/api/acgimg") img = requests.get('https://api.lolicon.app/setu/?r18=0')
elif website == 6:
img = get("http://api.mtyqx.cn/api/random.php")
elif website == 7:
img = get("http://random.firefliestudio.com/")
elif website == 8:
img = get("https://api.mmcee.cn/acgimg/acgurl.php")
elif website == 9:
img = get('https://api.lolicon.app/setu/?r18=0')
if img.status_code == 200: if img.status_code == 200:
if website == 9: if website == 5:
tmp = json.loads(img.content) tmp = json.loads(img.content)
img = tmp['data'][0]['url'] img = tmp['data'][0]['url']
img = 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(r'tu.png', 'wb') as f:

View File

@ -222,7 +222,7 @@
}, },
{ {
"name": "meizi", "name": "meizi",
"version": "1.2", "version": "1.3",
"section": "profile", "section": "profile",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.6 kb", "size": "2.6 kb",
@ -232,10 +232,10 @@
}, },
{ {
"name": "acg-multi", "name": "acg-multi",
"version": "1.1", "version": "1.2",
"section": "profile", "section": "profile",
"maintainer": "TNTcraftHIM", "maintainer": "TNTcraftHIM",
"size": "2.4 kb", "size": "2.3 kb",
"supported": true, "supported": true,
"des-short": "多网站随机获取ACG图", "des-short": "多网站随机获取ACG图",
"des": "从几个不同的图库中随机获取二刺螈bushiACG图片基本都是手机尺寸的图。命令acgm。" "des": "从几个不同的图库中随机获取二刺螈bushiACG图片基本都是手机尺寸的图。命令acgm。"
@ -259,6 +259,16 @@
"supported": true, "supported": true,
"des-short": "祖安对线语录", "des-short": "祖安对线语录",
"des": "让你在祖安大舞台能够时而儒雅时而火力全开的对线。命令dissbiss。" "des": "让你在祖安大舞台能够时而儒雅时而火力全开的对线。命令dissbiss。"
},
{
"name": "shangliu",
"version": "1.0",
"section": "chat",
"maintainer": "TNTcraftHIM",
"size": "2.5 kb",
"supported": true,
"des-short": "上流对话工具",
"des": "让你可以随时放彩虹屁,毒鸡汤,或者变身营销号(迫真,配合-tts食用更佳。命令chpdjtyxh。"
} }
] ]
} }

View File

@ -13,15 +13,15 @@ async def meizi(context):
for _ in range (20): #最多重试20次 for _ in range (20): #最多重试20次
website = random.randint(0, 13) website = random.randint(0, 13)
if website == 0: if website == 0:
img = get("https://mm.52.mk") img = get("https://mm.52.mk/img")
elif website == 1: elif website == 1:
img = get("https://api.helloworld.la/xiezhen_xinggan.php") img = get("https://api.helloworld.la/xiezhen_xinggan.php")
elif website == 2: elif website == 2:
img = get("https://api.qicaiyun.top/sjbz/api.php?lx=meizi") img = get("https://api.66mz8.com/api/rand.tbimg.php")
elif website == 3: elif website == 3:
img = get("http://api.btstu.cn/sjbz/?lx=meizi") img = get("https://api.isoyu.com/mm_images.php")
elif website == 4: elif website == 4:
img = get("https://cdn.seovx.com/?mom=302") img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A5%B3")
elif website == 5: elif website == 5:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A6%B9%E5%AD%90") img = get("https://uploadbeta.com/api/pictures/random/?key=%E5%A6%B9%E5%AD%90")
elif website == 6: elif website == 6:
@ -29,17 +29,17 @@ async def meizi(context):
elif website == 7: elif website == 7:
img = get("https://uploadbeta.com/api/pictures/random/?key=%E7%BE%8E%E5%A5%B3") img = get("https://uploadbeta.com/api/pictures/random/?key=%E7%BE%8E%E5%A5%B3")
elif website == 8: elif website == 8:
img = get("https://api.941ka.cn/api/mnxz") img = get("https://api.diskgirl.com/image/api.php?t=xinggan&v=" + str(random.uniform(0, 100)))
elif website == 9: elif website == 9:
img = get("https://api.lyiqk.cn/sexylady") img = get("https://api.lyiqk.cn/sexylady")
elif website == 10: elif website == 10:
img = get("https://api.pingping6.com/tools/acg3/index.php") img = get("https://api.pingping6.com/tools/acg3/index.php")
elif website == 11: elif website == 11:
img = get("https://api.pingping6.com/tools/acg3") img = get("https://api.uomg.com/api/rand.img3")
elif website == 12: elif website == 12:
img = get("https://api.diskgirl.com/image/api.php?t=&v=0.9451485087333713") img = get("https://api.diskgirl.com/image/api.php?t=&v=0.9451485087333713")
elif website == 13: elif website == 13:
img = get("https://api.diskgirl.com/image/api.php?t=&v=" + str(random.uniform(0, 100))) 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(r'tu.png', 'wb') as f:
await context.edit("正在上传图片") await context.edit("正在上传图片")

52
shangliu.py Normal file
View File

@ -0,0 +1,52 @@
from time import sleep
from requests import get
from pagermaid.listener import listener
@listener(is_plugin=True, outgoing=True, command="chp",
description="彩虹屁生成器。")
async def chp(context):
await context.edit("获取中 . . .")
status=False
for _ in range(20): #最多尝试20次
req = get("https://chp.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()
@listener(is_plugin=True, outgoing=True, command="djt",
description="毒鸡汤生成器。")
async def djt(context):
await context.edit("获取中 . . .")
status=False
for _ in range(20): #最多尝试20次
req = get("https://du.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()
@listener(is_plugin=True, outgoing=True, command="yxh",
description="营销号文案生成器建议配合tts食用", parameters="<主体> <事件> <原因>")
async def yxh(context):
try:
await context.edit("生成中 . . .")
text = f"{context.parameter[0]}{context.parameter[1]}是怎么回事呢?{context.parameter[0]}相信大家都很熟悉,但是{context.parameter[0]}{context.parameter[1]}是怎么回事呢,下面就让小编带大家一起了解吧。\n{context.parameter[0]}{context.parameter[1]},其实就是{context.parameter[2]},大家可能会很惊讶{context.parameter[0]}怎么会{context.parameter[1]}呢?但事实就是这样,小编也感到非常惊讶。\n这就是关于{context.parameter[0]}{context.parameter[1]}的事情了,大家有什么想法呢,欢迎在评论区告诉小编一起讨论哦!"
except IndexError:
await context.edit("使用方法:-yxh <主体> <事件> <原因>")
return
await context.edit(text)