yz-yuki-plugin 2.0.6-18 → 2.0.6-19
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/CHANGELOG.md
CHANGED
|
@@ -184,10 +184,16 @@ class BiliTask {
|
|
|
184
184
|
if (pushMsgMode === 'PIC') {
|
|
185
185
|
const { data, uid } = await BiliQuery.formatDynamicData(pushDynamicData); // 处理动态数据
|
|
186
186
|
const extentData = { ...data };
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
const getBanWords = biliConfigData?.banWords;
|
|
188
|
+
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
189
|
+
// 构建屏蔽关键字正则表达式,转义特殊字符
|
|
190
|
+
const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
|
|
191
|
+
if (banWords.test(`${extentData?.title}${extentData?.content}`)) {
|
|
192
|
+
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
else if (getBanWords && !Array.isArray(getBanWords)) {
|
|
196
|
+
logger.error(`B站动态:Yaml配置文件中,banWords 字段格式不是数组格式,请检查!`);
|
|
191
197
|
}
|
|
192
198
|
let boxGrid = !!biliConfigData.boxGrid === false ? false : true; // 是否启用九宫格样式,默认为 true
|
|
193
199
|
let isSplit = !!biliConfigData.isSplit === false ? false : true; // 是否启用分片截图,默认为 true
|
|
@@ -219,11 +225,15 @@ class BiliTask {
|
|
|
219
225
|
}
|
|
220
226
|
const getBanWords = biliConfigData?.banWords;
|
|
221
227
|
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
222
|
-
|
|
228
|
+
// 构建屏蔽关键字正则表达式,转义特殊字符
|
|
229
|
+
const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
|
|
223
230
|
if (banWords.test(dynamicMsg.msg.join(''))) {
|
|
224
231
|
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
225
232
|
}
|
|
226
233
|
}
|
|
234
|
+
else if (getBanWords && !Array.isArray(getBanWords)) {
|
|
235
|
+
logger.error(`B站动态:Yaml配置文件中,banWords 字段格式不是数组格式,请检查!`);
|
|
236
|
+
}
|
|
227
237
|
let mergeTextPic = !!biliConfigData.mergeTextPic === false ? false : true; // 是否合并文本和图片,默认为 true
|
|
228
238
|
//开启了合并文本和图片
|
|
229
239
|
if (mergeTextPic === true) {
|
|
@@ -149,10 +149,16 @@ class WeiboTask {
|
|
|
149
149
|
return; // 如果已经发送过,则直接返回
|
|
150
150
|
if (!!weiboConfigData.pushMsgMode) {
|
|
151
151
|
const { data, uid } = await WeiboQuery.formatDynamicData(pushDynamicData); // 处理动态数据
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
152
|
+
const getBanWords = weiboConfigData?.banWords;
|
|
153
|
+
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
154
|
+
// 构建屏蔽关键字正则表达式,转义特殊字符
|
|
155
|
+
const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
|
|
156
|
+
if (banWords.test(`${data?.title}${data?.content}`)) {
|
|
157
|
+
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else if (getBanWords && !Array.isArray(getBanWords)) {
|
|
161
|
+
logger.error(`微博动态:Yaml配置文件中,banWords 字段格式不是数组格式,请检查!`);
|
|
156
162
|
}
|
|
157
163
|
let boxGrid = !!weiboConfigData.boxGrid === false ? false : true; // 是否启用九宫格样式,默认为 true
|
|
158
164
|
let isSplit = !!weiboConfigData.isSplit === false ? false : true; // 是否启用分片截图,默认为 true
|
|
@@ -185,11 +191,15 @@ class WeiboTask {
|
|
|
185
191
|
}
|
|
186
192
|
const getBanWords = weiboConfigData?.banWords;
|
|
187
193
|
if (getBanWords && Array.isArray(getBanWords) && getBanWords.length > 0) {
|
|
188
|
-
|
|
194
|
+
// 构建屏蔽关键字正则表达式,转义特殊字符
|
|
195
|
+
const banWords = new RegExp(getBanWords.map(word => word.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')).join('|'), 'g');
|
|
189
196
|
if (banWords.test(dynamicMsg.msg.join(''))) {
|
|
190
197
|
return 'return'; // 如果动态消息包含屏蔽关键字,则直接返回
|
|
191
198
|
}
|
|
192
199
|
}
|
|
200
|
+
else if (getBanWords && !Array.isArray(getBanWords)) {
|
|
201
|
+
logger.error(`微博动态:Yaml配置文件中,banWords 字段格式不是数组格式,请检查!`);
|
|
202
|
+
}
|
|
193
203
|
let mergeTextPic = !!weiboConfigData.mergeTextPic === false ? false : true; // 是否合并文字和图片,默认为 true
|
|
194
204
|
//开启了合并文本和图片
|
|
195
205
|
if (mergeTextPic === true) {
|