diff options
author | Lint Action <[email protected]> | 2021-07-09 05:03:38 +0000 |
---|---|---|
committer | Lint Action <[email protected]> | 2021-07-09 05:03:38 +0000 |
commit | 33f456a2b600d81b7bfe5040e03e85caaa66a68c (patch) | |
tree | c0c53fdc92848ef0ec1b6f6c63dce8d204c4d850 /ATRI | |
parent | c5ea0295a8fbe24371b4ad077df495a7ea3ba4f7 (diff) | |
download | ATRI-33f456a2b600d81b7bfe5040e03e85caaa66a68c.tar.gz ATRI-33f456a2b600d81b7bfe5040e03e85caaa66a68c.tar.bz2 ATRI-33f456a2b600d81b7bfe5040e03e85caaa66a68c.zip |
:rotating_light: 自动进行代码格式化
Diffstat (limited to 'ATRI')
-rw-r--r-- | ATRI/plugins/setu/data_source.py | 26 |
1 files 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 |