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.
Files changed (2) hide show
  1. package/lib/index.js +2 -9
  2. 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 elements = import_koishi.h.parse(item.content);
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
- }, textOnlyElements);
59
+ }, pureText);
67
60
  });
68
61
  const partNum = Math.floor(i / chunkSize) + 1;
69
62
  const totalParts = Math.ceil(newsList.length / chunkSize);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-booknews",
3
3
  "description": "It's a plugin for booknews collection",
4
- "version": "0.0.4",
4
+ "version": "0.0.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [