koishi-plugin-video-parser-all 1.5.2 → 1.5.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.d.ts CHANGED
@@ -38,6 +38,8 @@ export declare const Config: Schema<{
38
38
  showImageText?: boolean | null | undefined;
39
39
  showCoverImage?: boolean | null | undefined;
40
40
  showCoverFile?: boolean | null | undefined;
41
+ showCoverText?: boolean | null | undefined;
42
+ coverText?: string | null | undefined;
41
43
  showImageFileNew?: boolean | null | undefined;
42
44
  showAuthorAvatar?: boolean | null | undefined;
43
45
  showAuthorAvatarFile?: boolean | null | undefined;
@@ -191,6 +193,8 @@ export declare const Config: Schema<{
191
193
  showImageText: boolean;
192
194
  showCoverImage: boolean;
193
195
  showCoverFile: boolean;
196
+ showCoverText: boolean;
197
+ coverText: string;
194
198
  showImageFileNew: boolean;
195
199
  showAuthorAvatar: boolean;
196
200
  showAuthorAvatarFile: boolean;
package/lib/index.js CHANGED
@@ -109,10 +109,12 @@ exports.Config = koishi_1.Schema.intersect([
109
109
  showImageText: koishi_1.Schema.boolean().default(true).description('发送文字内容'),
110
110
  showCoverImage: koishi_1.Schema.boolean().default(true).description('发送封面图片'),
111
111
  showCoverFile: koishi_1.Schema.boolean().default(true).description('封面是否以图片形式发送(关闭则只发送链接)'),
112
+ showCoverText: koishi_1.Schema.boolean().default(true).description('发送封面前显示文字提示'),
113
+ coverText: koishi_1.Schema.string().default('封面:').description('封面前显示的文字'),
112
114
  showImageFileNew: koishi_1.Schema.boolean().default(true).description('图片是否以图片形式发送(关闭则只发送链接)'),
113
115
  showAuthorAvatar: koishi_1.Schema.boolean().default(true).description('发送作者头像图片'),
114
116
  showAuthorAvatarFile: koishi_1.Schema.boolean().default(true).description('作者头像图片是否以图片形式发送(关闭则只发送链接)'),
115
- showAuthorAvatarText: koishi_1.Schema.boolean().default(true).description('发送作者头像前显示文字提示'),
117
+ showAuthorAvatarText: koishi_1.Schema.boolean().default(true).description('作者头像前显示文字提示(将追加到文字消息末尾)'),
116
118
  authorAvatarText: koishi_1.Schema.string().default('作者头像:').description('作者头像前显示的文字'),
117
119
  showMusicCover: koishi_1.Schema.boolean().default(true).description('发送音乐封面图片'),
118
120
  showVideoFile: koishi_1.Schema.boolean().default(true).description('视频是否以视频形式发送(关闭则只发送链接)'),
@@ -1130,16 +1132,20 @@ function apply(ctx, config) {
1130
1132
  const forwardMessages = [];
1131
1133
  for (const item of items) {
1132
1134
  const p = item.parsed;
1133
- const text = item.text;
1134
- if (text && config.showImageText)
1135
- forwardMessages.push(buildForwardNode(session, text, botName));
1135
+ let text = item.text;
1136
1136
  if (config.showAuthorAvatar && p.avatar && config.showAuthorAvatarText) {
1137
- forwardMessages.push(buildForwardNode(session, config.authorAvatarText || '作者头像:', botName));
1137
+ text = text ? text + '\n' + (config.authorAvatarText || '作者头像:') : (config.authorAvatarText || '作者头像:');
1138
+ }
1139
+ if (text && config.showImageText) {
1140
+ forwardMessages.push(buildForwardNode(session, text, botName));
1138
1141
  }
1139
1142
  if (config.showAuthorAvatar && p.avatar) {
1140
1143
  forwardMessages.push(buildForwardNode(session, koishi_1.h.image(p.avatar), botName));
1141
1144
  }
1142
1145
  if (p.cover && config.showCoverImage && p.type !== 'live_photo' && p.type !== 'image' && p.type !== 'live') {
1146
+ if (config.showCoverText) {
1147
+ forwardMessages.push(buildForwardNode(session, config.coverText || '封面:', botName));
1148
+ }
1143
1149
  forwardMessages.push(buildForwardNode(session, koishi_1.h.image(p.cover), botName));
1144
1150
  }
1145
1151
  if (config.showMusicCover && p.music.cover) {
@@ -1147,11 +1153,13 @@ function apply(ctx, config) {
1147
1153
  }
1148
1154
  if (p.type === 'image' || p.type === 'live_photo' || (p.type === 'live' && (p.live_photo?.length || p.images?.length))) {
1149
1155
  const imageUrls = p.images?.length ? p.images : (p.live_photo?.map(lp => lp.image) ?? []);
1150
- for (const imgUrl of imageUrls)
1156
+ for (const imgUrl of imageUrls) {
1151
1157
  forwardMessages.push(buildForwardNode(session, koishi_1.h.image(imgUrl), botName));
1158
+ }
1152
1159
  }
1153
- if (p.video && p.type !== 'live')
1160
+ if (p.video && p.type !== 'live') {
1154
1161
  forwardMessages.push(buildForwardNode(session, koishi_1.h.video(p.video), botName));
1162
+ }
1155
1163
  if (config.showMusicVoice && p.music.url) {
1156
1164
  forwardMessages.push(buildForwardNode(session, koishi_1.h.audio(p.music.url), botName));
1157
1165
  }
@@ -1172,20 +1180,21 @@ function apply(ctx, config) {
1172
1180
  else {
1173
1181
  for (const item of items) {
1174
1182
  const p = item.parsed;
1175
- const text = item.text;
1183
+ let text = item.text;
1184
+ if (config.showAuthorAvatar && p.avatar && config.showAuthorAvatarText) {
1185
+ text = text ? text + '\n' + (config.authorAvatarText || '作者头像:') : (config.authorAvatarText || '作者头像:');
1186
+ }
1176
1187
  if (text && config.showImageText) {
1177
1188
  await sendWithTimeout(session, text);
1178
1189
  await delay(300);
1179
1190
  }
1180
- if (config.showAuthorAvatar && p.avatar && config.showAuthorAvatarText) {
1181
- await sendWithTimeout(session, config.authorAvatarText || '作者头像:');
1182
- await delay(300);
1183
- }
1184
1191
  if (config.showAuthorAvatar && p.avatar) {
1185
1192
  await sendMedia(session, p.avatar, 'image', config.forceDownloadAuthorAvatar, config.showAuthorAvatarFile).catch(() => { });
1186
1193
  await delay(300);
1187
1194
  }
1188
1195
  if (p.cover && config.showCoverImage && p.type !== 'live_photo' && p.type !== 'image' && p.type !== 'live') {
1196
+ if (config.showCoverText)
1197
+ await sendWithTimeout(session, config.coverText || '封面:');
1189
1198
  await sendMedia(session, p.cover, 'image', config.forceDownloadCover, config.showCoverFile).catch(() => { });
1190
1199
  await delay(300);
1191
1200
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-video-parser-all",
3
3
  "description": "Koishi 全平台视频/图集解析插件,支持抖音/快手/B站/微博/小红书/剪映/YouTube/TikTok等20+平台",
4
- "version": "1.5.2",
4
+ "version": "1.5.4",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [
package/readme.md CHANGED
@@ -40,13 +40,16 @@ This is a **multi-platform video/image parsing plugin** developed for the Koishi
40
40
  | `showImageText` | boolean | true | 发送文字内容 (Send text content) |
41
41
  | `showCoverImage` | boolean | true | 发送封面图片 (Send cover image) |
42
42
  | `showCoverFile` | boolean | true | 封面是否以图片形式发送(关闭则只发送链接)(Send cover as image, otherwise link only) |
43
+ | `showCoverText` | boolean | true | 发送封面前显示文字提示 (Show text hint before cover image) |
44
+ | `coverText` | string | 封面: | 封面前显示的文字 (Text displayed before cover) |
43
45
  | `showImageFileNew` | boolean | true | 图片是否以图片形式发送(关闭则只发送链接)(Send images as image, otherwise link only) |
44
46
  | `showAuthorAvatar` | boolean | true | 发送作者头像图片 (Send author avatar image) |
45
47
  | `showAuthorAvatarFile` | boolean | true | 作者头像图片是否以图片形式发送(关闭则只发送链接)(Send author avatar as image, otherwise link only) |
46
- | `showAuthorAvatarText` | boolean | true | 发送作者头像前显示文字提示 (Show text hint before author avatar) |
48
+ | `showAuthorAvatarText` | boolean | true | 作者头像前显示文字提示(将追加到文字消息末尾)(Show text hint before author avatar, appended to the text message) |
47
49
  | `authorAvatarText` | string | 作者头像: | 作者头像前显示的文字 (Text displayed before author avatar) |
48
50
  | `showMusicCover` | boolean | true | 发送音乐封面图片 (Send music cover image) |
49
51
  | `showVideoFile` | boolean | true | 视频是否以视频形式发送(关闭则只发送链接)(Send video as file, otherwise link only) |
52
+ | `sendLiveMessage` | boolean | true | 直播作品发送文字消息(不发送视频)(Send text message for live streams, no video) |
50
53
  | `forceDownloadCover` | boolean | false | 强制下载封面 (Force download cover) |
51
54
  | `forceDownloadImageNew` | boolean | false | 强制下载图片 (Force download images) |
52
55
  | `forceDownloadAuthorAvatar` | boolean | false | 强制下载作者头像 (Force download author avatar) |