koishi-plugin-weibo-post-monitor 0.0.3 → 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.
Files changed (2) hide show
  1. package/lib/index.js +14 -0
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -46,6 +46,7 @@ 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
+ blockwords: import_koishi.Schema.string().description("屏蔽词(多个关键词用分号分隔)"),
49
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("@全体成员")
@@ -116,6 +117,7 @@ var getMessage = /* @__PURE__ */ __name((params, wbPost) => {
116
117
  }
117
118
  let message = "";
118
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-weibo-post-monitor",
3
3
  "description": "微博帖子更新推送插件,用于获取指定微博用户的最新帖子推送到指定群聊,参考代码https://github.com/moehuhu/weibo-monitor",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [