koishi-plugin-weibo-post-monitor 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +16 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -46,7 +46,8 @@ var Config = import_koishi.Schema.object({
|
|
|
46
46
|
sendINFO: import_koishi.Schema.array(import_koishi.Schema.object({
|
|
47
47
|
weiboUID: import_koishi.Schema.string().description("微博用户UID"),
|
|
48
48
|
forward: import_koishi.Schema.boolean().default(false).description("是否监听转发"),
|
|
49
|
-
|
|
49
|
+
blockwords: import_koishi.Schema.string().description("屏蔽词(多个关键词用分号分隔)"),
|
|
50
|
+
keywords: import_koishi.Schema.string().description("关键词(多个关键词用分号分隔)"),
|
|
50
51
|
groupID: import_koishi.Schema.string().description("需要发送的群组"),
|
|
51
52
|
sendAll: import_koishi.Schema.boolean().default(false).description("@全体成员")
|
|
52
53
|
})).description("监听&发送配置")
|
|
@@ -115,7 +116,8 @@ var getMessage = /* @__PURE__ */ __name((params, wbPost) => {
|
|
|
115
116
|
weiboType = 1;
|
|
116
117
|
}
|
|
117
118
|
let message = "";
|
|
118
|
-
let keywordsList = params.keywords
|
|
119
|
+
let keywordsList = params.keywords?.split(";") || [];
|
|
120
|
+
let blockwordsList = params.blockwords?.split(";") || [];
|
|
119
121
|
if (weiboType == 0) {
|
|
120
122
|
const pageInfo = wbPost?.page_info;
|
|
121
123
|
if (!pageInfo) {
|
|
@@ -156,6 +158,18 @@ var getMessage = /* @__PURE__ */ __name((params, wbPost) => {
|
|
|
156
158
|
return null;
|
|
157
159
|
}
|
|
158
160
|
}
|
|
161
|
+
if (blockwordsList.length > 0) {
|
|
162
|
+
let hasBlockwords = false;
|
|
163
|
+
for (const blockword of blockwordsList) {
|
|
164
|
+
if (message.includes(blockword)) {
|
|
165
|
+
hasBlockwords = true;
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (hasBlockwords) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
159
173
|
const wbpost = message ? message + url : screenName + " 发布了微博:\n" + wbPost?.text_raw + url || "";
|
|
160
174
|
return { post: wbpost, islast: true };
|
|
161
175
|
}, "getMessage");
|
package/package.json
CHANGED