koishi-plugin-video-parser-all 1.5.2 → 1.5.3
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 +4 -0
- package/lib/index.js +15 -10
- package/package.json +1 -1
- package/readme.md +4 -1
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,18 @@ function apply(ctx, config) {
|
|
|
1130
1132
|
const forwardMessages = [];
|
|
1131
1133
|
for (const item of items) {
|
|
1132
1134
|
const p = item.parsed;
|
|
1133
|
-
|
|
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
|
-
|
|
1137
|
+
text = text ? text + '\n' + (config.authorAvatarText || '作者头像:') : (config.authorAvatarText || '作者头像:');
|
|
1138
1138
|
}
|
|
1139
|
+
if (text && config.showImageText)
|
|
1140
|
+
forwardMessages.push(buildForwardNode(session, text, botName));
|
|
1139
1141
|
if (config.showAuthorAvatar && p.avatar) {
|
|
1140
1142
|
forwardMessages.push(buildForwardNode(session, koishi_1.h.image(p.avatar), botName));
|
|
1141
1143
|
}
|
|
1142
1144
|
if (p.cover && config.showCoverImage && p.type !== 'live_photo' && p.type !== 'image' && p.type !== 'live') {
|
|
1145
|
+
if (config.showCoverText)
|
|
1146
|
+
forwardMessages.push(buildForwardNode(session, config.coverText || '封面:', botName));
|
|
1143
1147
|
forwardMessages.push(buildForwardNode(session, koishi_1.h.image(p.cover), botName));
|
|
1144
1148
|
}
|
|
1145
1149
|
if (config.showMusicCover && p.music.cover) {
|
|
@@ -1172,20 +1176,21 @@ function apply(ctx, config) {
|
|
|
1172
1176
|
else {
|
|
1173
1177
|
for (const item of items) {
|
|
1174
1178
|
const p = item.parsed;
|
|
1175
|
-
|
|
1179
|
+
let text = item.text;
|
|
1180
|
+
if (config.showAuthorAvatar && p.avatar && config.showAuthorAvatarText) {
|
|
1181
|
+
text = text ? text + '\n' + (config.authorAvatarText || '作者头像:') : (config.authorAvatarText || '作者头像:');
|
|
1182
|
+
}
|
|
1176
1183
|
if (text && config.showImageText) {
|
|
1177
1184
|
await sendWithTimeout(session, text);
|
|
1178
1185
|
await delay(300);
|
|
1179
1186
|
}
|
|
1180
|
-
if (config.showAuthorAvatar && p.avatar && config.showAuthorAvatarText) {
|
|
1181
|
-
await sendWithTimeout(session, config.authorAvatarText || '作者头像:');
|
|
1182
|
-
await delay(300);
|
|
1183
|
-
}
|
|
1184
1187
|
if (config.showAuthorAvatar && p.avatar) {
|
|
1185
1188
|
await sendMedia(session, p.avatar, 'image', config.forceDownloadAuthorAvatar, config.showAuthorAvatarFile).catch(() => { });
|
|
1186
1189
|
await delay(300);
|
|
1187
1190
|
}
|
|
1188
1191
|
if (p.cover && config.showCoverImage && p.type !== 'live_photo' && p.type !== 'image' && p.type !== 'live') {
|
|
1192
|
+
if (config.showCoverText)
|
|
1193
|
+
await sendWithTimeout(session, config.coverText || '封面:');
|
|
1189
1194
|
await sendMedia(session, p.cover, 'image', config.forceDownloadCover, config.showCoverFile).catch(() => { });
|
|
1190
1195
|
await delay(300);
|
|
1191
1196
|
}
|
package/package.json
CHANGED
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 |
|
|
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) |
|