From 33f456a2b600d81b7bfe5040e03e85caaa66a68c Mon Sep 17 00:00:00 2001 From: Lint Action Date: Fri, 9 Jul 2021 05:03:38 +0000 Subject: =?UTF-8?q?:rotating=5Flight:=20=E8=87=AA=E5=8A=A8=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ATRI/plugins/setu/data_source.py | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/ATRI/plugins/setu/data_source.py b/ATRI/plugins/setu/data_source.py index 0912e25..46cf7cb 100644 --- a/ATRI/plugins/setu/data_source.py +++ b/ATRI/plugins/setu/data_source.py @@ -14,10 +14,9 @@ SCHEDULER_FORMAT = """ class Setu(Service): - def __init__(self): Service.__init__(self, "涩图", "hso!", rule=is_in_service("涩图")) - + @staticmethod async def random_setu() -> tuple: """ @@ -26,13 +25,13 @@ class Setu(Service): res = await request.get(LOLICON_URL) data: dict = await res.json() temp_data: dict = data.get("data", list())[0] - - title = temp_data.get("title", "木陰のねこ") + + title = temp_data.get("title", "木陰のねこ") p_id = temp_data.get("pid", 88124144) url = temp_data["urls"].get("original", "ignore") setu = MessageSegment.image(url) return setu, title, p_id - + @staticmethod async def tag_setu(tag: str) -> tuple: """ @@ -41,18 +40,18 @@ class Setu(Service): url = LOLICON_URL + f"?tag={tag}" res = await request.get(url) data: dict = await res.json() - + temp_data: dict = data.get("data", list())[0] if not temp_data: is_ok = False is_ok = True - - title = temp_data.get("title", "木陰のねこ") + + title = temp_data.get("title", "木陰のねこ") p_id = temp_data.get("pid", 88124144) url = temp_data["urls"].get("original", "ignore") setu = MessageSegment.image(url) return setu, title, p_id, is_ok - + @staticmethod async def scheduler() -> str: """ @@ -64,13 +63,10 @@ class Setu(Service): res = await request.get(LOLICON_URL) data: dict = await res.json() temp_data: dict = data.get("data", list())[0] - + tag = choice(temp_data.get("tags", ["女孩子"])) - + url = temp_data["urls"].get("original", "ignore") setu = MessageSegment.image(url) - repo = SCHEDULER_FORMAT.format( - tag=tag, - setu=setu - ) + repo = SCHEDULER_FORMAT.format(tag=tag, setu=setu) return repo -- cgit v1.2.3