koishi-plugin-booknews 0.0.4 → 0.0.5
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 +2 -9
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -51,19 +51,12 @@ function apply(ctx, config) {
|
|
|
51
51
|
for (let i = 0; i < newsList.length; i += chunkSize) {
|
|
52
52
|
const chunk = newsList.slice(i, i + chunkSize);
|
|
53
53
|
const nodes = chunk.map((item) => {
|
|
54
|
-
const
|
|
55
|
-
const textOnlyElements = import_koishi.h.transform(elements, {
|
|
56
|
-
// 当遇到 image 元素时,返回 null 即可将其从结果中移除
|
|
57
|
-
image: /* @__PURE__ */ __name(() => null, "image"),
|
|
58
|
-
// 如果有录音或视频也可以在此移除
|
|
59
|
-
audio: /* @__PURE__ */ __name(() => null, "audio"),
|
|
60
|
-
video: /* @__PURE__ */ __name(() => null, "video")
|
|
61
|
-
});
|
|
54
|
+
const pureText = item.content.replace(/<img[^>]*>|<img>.*?<\/img>/g, "");
|
|
62
55
|
return (0, import_koishi.h)("message", {
|
|
63
56
|
forward: true,
|
|
64
57
|
userId: bot.selfId,
|
|
65
58
|
nickname: item.authorName
|
|
66
|
-
},
|
|
59
|
+
}, pureText);
|
|
67
60
|
});
|
|
68
61
|
const partNum = Math.floor(i / chunkSize) + 1;
|
|
69
62
|
const totalParts = Math.ceil(newsList.length / chunkSize);
|