@@ -41,30 +41,7 @@ def group_message(plugin_event, Proc):
41
41
42
42
43
43
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 ):
68
45
response = requests .get (url )
69
46
70
47
if response .status_code != 200 :
@@ -98,3 +75,29 @@ def unity_reply(plugin_event, Proc):
98
75
99
76
result = get_random_items (bookmarks )
100
77
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