koishi-plugin-share-links-analysis 0.6.2 → 0.6.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.js +2 -2
- package/lib/types.d.ts +1 -1
- package/lib/utils.js +15 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -25,8 +25,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
25
25
|
koishi_1.Schema.const('2').description('高清晰度优先'),
|
|
26
26
|
]).role('radio').default('1').description("发送的视频清晰度优先策略"),
|
|
27
27
|
Max_size: koishi_1.Schema.number().default(20).description("允许发送的最大文件大小(Mb)"),
|
|
28
|
-
|
|
29
|
-
MinimumTimeInterval: koishi_1.Schema.number().default(600).description("若干秒内不再处理相同链接,防止刷屏").min(1),
|
|
28
|
+
Min_Interval: koishi_1.Schema.number().default(600).description("若干秒内不再处理相同链接,防止刷屏").min(1),
|
|
30
29
|
waitTip_Switch: koishi_1.Schema.union([
|
|
31
30
|
koishi_1.Schema.const(false).description('不返回文字提示'),
|
|
32
31
|
koishi_1.Schema.string().description('返回文字提示'),
|
|
@@ -37,6 +36,7 @@ exports.Config = koishi_1.Schema.intersect([
|
|
|
37
36
|
koishi_1.Schema.const("mixed").description("混合发送"),
|
|
38
37
|
]).default("forward").description("发送模式"),
|
|
39
38
|
sendFiles: koishi_1.Schema.boolean().default(true).description("是否发送文件(视频等)"),
|
|
39
|
+
sendLinks: koishi_1.Schema.boolean().default(false).description("是否附加直链(仅对合并发送有效)"),
|
|
40
40
|
}).description("基础设置"),
|
|
41
41
|
koishi_1.Schema.object({
|
|
42
42
|
format: koishi_1.Schema.string().role('textarea').default(`{title}
|
package/lib/types.d.ts
CHANGED
|
@@ -21,11 +21,11 @@ export interface FileInfo {
|
|
|
21
21
|
export interface PluginConfig {
|
|
22
22
|
Video_ClarityPriority: '1' | '2';
|
|
23
23
|
Max_size: number;
|
|
24
|
-
Max_size_tip: string;
|
|
25
24
|
Min_Interval: number;
|
|
26
25
|
waitTip_Switch: false | string;
|
|
27
26
|
useForward: 'plain' | 'forward' | 'mixed';
|
|
28
27
|
sendFiles: boolean;
|
|
28
|
+
sendLinks: boolean;
|
|
29
29
|
format: string;
|
|
30
30
|
parseLimit: number;
|
|
31
31
|
useNumeral: boolean;
|
package/lib/utils.js
CHANGED
|
@@ -392,7 +392,7 @@ async function sendResult_plain(session, config, result, logger) {
|
|
|
392
392
|
if (config.logLevel !== 'none') {
|
|
393
393
|
const sizeMB = (sizeBytes / (1024 * 1024)).toFixed(2);
|
|
394
394
|
const maxMB = config.Max_size.toFixed(2);
|
|
395
|
-
sendPromises.push(session.send(`文件大小超限 (${sizeMB} MB > ${maxMB} MB)
|
|
395
|
+
sendPromises.push(session.send(`文件大小超限 (${sizeMB} MB > ${maxMB} MB)`));
|
|
396
396
|
logger.info(`文件大小超限 (${sizeMB} MB > ${maxMB} MB),跳过: ${remoteUrl}`);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
@@ -546,7 +546,7 @@ async function sendResult_forward(session, config, result, logger, mixed_sending
|
|
|
546
546
|
nickname: '分享助手',
|
|
547
547
|
content: {
|
|
548
548
|
type: 'text', data: {
|
|
549
|
-
text: `文件大小超限 (${sizeMB} MB > ${maxMB} MB)
|
|
549
|
+
text: `文件大小超限 (${sizeMB} MB > ${maxMB} MB)`
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
}
|
|
@@ -607,6 +607,19 @@ async function sendResult_forward(session, config, result, logger, mixed_sending
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
+
if (config.sendLinks && Array.isArray(result.files)) {
|
|
611
|
+
for (const file of result.files) {
|
|
612
|
+
const { type, url: Url } = file;
|
|
613
|
+
forwardNodes.push({
|
|
614
|
+
type: 'node',
|
|
615
|
+
data: {
|
|
616
|
+
user_id: session.selfId,
|
|
617
|
+
nickname: '分享助手',
|
|
618
|
+
content: [{ type: 'text', data: { text: `${type}: ${Url}` } }]
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
}
|
|
610
623
|
if (forwardNodes.length === 0 && extraSendPromises.length === 0)
|
|
611
624
|
return;
|
|
612
625
|
if (config.logLevel === 'full') {
|