Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Commit d6eaf7e

Browse files
committed
🐛修复了缩进bug
1 parent 685d22b commit d6eaf7e

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

AO3Search/app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"namespace" : "AO3Search",
55
"info" : "这是一个基于镜像站\"nightalk.cc\"随机推文的AO3插件\n\n指令格式\n来篇海维文[-h|-help|-E|-Explicit|-M|-Mature]或来篇海维黄文",
66
"priority" : 30000,
7-
"version" : "0406.post1",
8-
"svn" :4 ,
7+
"version" : "0406.post2",
8+
"svn" :5 ,
99
"compatible_svn" : 101,
1010
"message_mode" : "olivos_string",
1111
"support" : [

AO3Search/main.py

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,7 @@ def group_message(plugin_event, Proc):
4141

4242

4343
def unity_reply(plugin_event, Proc):
44-
help_doc = """\
45-
AO3Search help
46-
这是一个基于镜像站"nightalk.cc"随机推文的AO3插件
47-
48-
指令(大小写不敏感)
49-
来篇海维文[-h|-help|-E|-Explicit|-M|-Mature]
50-
or 来篇海维黄文
51-
52-
-h|-help //获取该帮助信息
53-
-E|-Explicit //设置返回Explicit分级内容
54-
-M|-Mature //设置返回Mature分级内容
55-
"""
56-
if plugin_event.data.message.startswith("来篇海维文"):
57-
url = f"{base_url}{settings[0]}"
58-
if is_string_endwith(plugin_event.data.message, "-M", "-Mature"):
59-
url = f"{base_url}{settings[1]}"
60-
if is_string_endwith(plugin_event.data.message, "-E", "-Explicit"):
61-
url = f"{base_url}{settings[2]}"
62-
if is_string_endwith(plugin_event.data.message, "-H", "-Help"):
63-
plugin_event.reply(help_doc)
64-
return
65-
elif plugin_event.data.message == "来篇海维黄文":
66-
url = f"{base_url}{settings[random.randint(1, 2)]}"
67-
44+
def proc(url):
6845
response = requests.get(url)
6946

7047
if response.status_code != 200:
@@ -98,3 +75,29 @@ def unity_reply(plugin_event, Proc):
9875

9976
result = get_random_items(bookmarks)
10077
plugin_event.reply("\n".join(result))
78+
79+
help_doc = """\
80+
AO3Search help
81+
这是一个基于镜像站"nightalk.cc"随机推文的AO3插件
82+
83+
指令(大小写不敏感)
84+
来篇海维文[-h|-help|-E|-Explicit|-M|-Mature]
85+
or 来篇海维黄文
86+
87+
-h|-help //获取该帮助信息
88+
-E|-Explicit //设置返回Explicit分级内容
89+
-M|-Mature //设置返回Mature分级内容
90+
"""
91+
if plugin_event.data.message.startswith("来篇海维文"):
92+
url = f"{base_url}{settings[0]}"
93+
if is_string_endwith(plugin_event.data.message, "-M", "-Mature"):
94+
url = f"{base_url}{settings[1]}"
95+
if is_string_endwith(plugin_event.data.message, "-E", "-Explicit"):
96+
url = f"{base_url}{settings[2]}"
97+
if is_string_endwith(plugin_event.data.message, "-H", "-Help"):
98+
plugin_event.reply(help_doc)
99+
return
100+
proc(url=url)
101+
elif plugin_event.data.message == "来篇海维黄文":
102+
url = f"{base_url}{settings[random.randint(1, 2)]}"
103+
proc(url=url)

0 commit comments

Comments
 (0)