diff options
author | Kyomotoi <[email protected]> | 2020-07-07 10:50:33 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-07-07 10:50:33 +0800 |
commit | 38bb1c0126d5991851f9706b5dd3615a8344d27c (patch) | |
tree | f9a372c3e1ff4c0367e6aede1df91974699eb2cd /AyaBot/plugins | |
parent | 8c1486e0bb162b302950271794cd3d62e4dc50cd (diff) | |
download | ATRI-38bb1c0126d5991851f9706b5dd3615a8344d27c.tar.gz ATRI-38bb1c0126d5991851f9706b5dd3615a8344d27c.tar.bz2 ATRI-38bb1c0126d5991851f9706b5dd3615a8344d27c.zip |
[CHANGE] setu
Diffstat (limited to 'AyaBot/plugins')
-rw-r--r-- | AyaBot/plugins/setu.py | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/AyaBot/plugins/setu.py b/AyaBot/plugins/setu.py index 3f24129..c4de870 100644 --- a/AyaBot/plugins/setu.py +++ b/AyaBot/plugins/setu.py @@ -17,7 +17,7 @@ async def post_bytes(url, headers=None,data=None): a = '1' -b = '2' +b = '1' c = '3' hphoto_switch = True @@ -51,32 +51,23 @@ async def _(session: CommandSession): @on_command('hphoto', aliases=['涩图', '涩图来!', '涩图来', '图来', '开冲', '来点好康的', '来丶好康的', '车来'], only_to_me=False) async def _(session: CommandSession): if hphoto_switch: - r = random.choice([a, b]) - print(r) - if r == '1': - URL = 'https://konachan.com/post.json' - response = requests.request("GET", URL) - html = response.text - hp = json.loads(html) - re = random.randint(0,20) - pt = hp[re]["jpeg_url"] - await session.send(f'[CQ:image,file={pt}]') - if r == '2': - url = 'https://api.lolicon.app/setu/' - apikey = bot.config.LOLICONAPI - values = { - "apikey": apikey, - "r18": "0", - "num": "1" - } - response = requests.get(url, params=values) - html = response.text - se = json.loads(html) - # print(se) - title=se["data"][0]["title"] - pid=se["data"][0]["pid"] - setu=se["data"][0]["url"] - await session.send(f'Title: {title}\nPid: {pid}\n[CQ:image,file={setu}]') + + url = 'https://api.lolicon.app/setu/' + apikey = bot.config.LOLICONAPI + values = { + "apikey": apikey, + "r18": "0", + "num": "1" + } + response = requests.get(url, params=values) + html = response.text + se = json.loads(html) + # print(se) + title=se["data"][0]["title"] + pid=se["data"][0]["pid"] + setu=se["data"][0]["url"] + await session.send(f'Title: {title}\nPid: {pid}\n[CQ:image,file={setu}]') + # if r == '2': # URL = 'https://danbooru.donmai.us/post.json' # values = { |