koishi-plugin-share-links-analysis 0.6.1 → 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 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
- Max_size_tip: koishi_1.Schema.string().default('文件体积过大,策略已阻止发送').description("对大文件的文字提示内容"),
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
@@ -477,10 +477,10 @@ async function sendResult_forward(session, config, result, logger, mixed_sending
477
477
  }
478
478
  // === 主消息(不含媒体文件)===
479
479
  let message = config.format;
480
- message = message.replace(/{title}/g, escapeHtml(result.title || ''));
481
- message = message.replace(/{authorName}/g, escapeHtml(result.authorName || ''));
482
- message = message.replace(/{sourceUrl}/g, escapeHtml(result.sourceUrl || ''));
483
- message = message.replace(/{stats}/g, escapeHtml(result.stats || ''));
480
+ message = message.replace(/{title}/g, result.title || '');
481
+ message = message.replace(/{authorName}/g, result.authorName || '');
482
+ message = message.replace(/{sourceUrl}/g, result.sourceUrl || '');
483
+ message = message.replace(/{stats}/g, result.stats || '');
484
484
  const lines = message.split('\n').filter(line => line.trim() !== '');
485
485
  const mainSegments = [];
486
486
  for (let i = 0; i < lines.length; i++) {
@@ -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') {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "koishi-plugin-share-links-analysis",
3
3
  "description": "自用插件",
4
4
  "license": "MIT",
5
- "version": "0.6.1",
5
+ "version": "0.6.3",
6
6
  "main": "lib/index.js",
7
7
  "typings": "lib/index.d.ts",
8
8
  "files": [