yz-yuki-plugin 2.0.7-15 → 2.0.7-17

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.
@@ -384,7 +384,7 @@ class BiliQuery {
384
384
  static async formatTextDynamicData(upName, data, isForward, setData) {
385
385
  const BiliDrawDynamicLinkUrl = 'https://m.bilibili.com/dynamic/';
386
386
  let desc, msg = [], pics = [], author, majorType, content, dynamicTitle, module_stat;
387
- let msg_meta = `B站【${upName}】动态推送:\n`;
387
+ let msg_meta = `B站【${upName}】动态推送:`;
388
388
  let dynamicType = data.type;
389
389
  function formatNumber(num) {
390
390
  if (num >= 10000) {
@@ -400,19 +400,23 @@ class BiliQuery {
400
400
  if (!desc && !author)
401
401
  return;
402
402
  module_stat = data?.modules?.module_stat;
403
- msg_meta = `B站【${upName}】视频动态推送:\n`;
403
+ msg_meta = `B站【${upName}】视频动态推送:`;
404
404
  msg = [
405
405
  msg_meta,
406
406
  `\n--------------------`,
407
407
  `\n${desc.title}`, // 标题
408
408
  `\n--------------------`,
409
409
  `\n视频简介:`,
410
- `${desc.desc}\n`,
410
+ `\n${desc.desc}`,
411
411
  `\n--------------------`,
412
- `投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
412
+ `\n投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
413
413
  `\n--------------------`,
414
414
  `\n${desc?.stat?.danmaku}弹幕 • ${desc?.stat?.play}播放`,
415
- `\n${formatNumber(module_stat?.like?.count)}点赞 • ${formatNumber(module_stat?.comment?.count)}评论 • ${formatNumber(module_stat?.forward?.count)}转发`,
415
+ ...(module_stat
416
+ ? [
417
+ `\n${formatNumber(module_stat.like?.count)}点赞 • ${formatNumber(module_stat.comment?.count)}评论 • ${formatNumber(module_stat.forward?.count)}转发`
418
+ ]
419
+ : []),
416
420
  `\n--------------------`,
417
421
  `\n链接:${this.formatUrl(desc.jump_url)}`
418
422
  ];
@@ -440,7 +444,7 @@ class BiliQuery {
440
444
  if (!desc && !author)
441
445
  return;
442
446
  module_stat = data?.modules?.module_stat;
443
- msg_meta = `B站【${upName}】图文动态推送:\n`;
447
+ msg_meta = `B站【${upName}】图文动态推送:`;
444
448
  msg = [
445
449
  msg_meta,
446
450
  `\n--------------------`,
@@ -449,9 +453,12 @@ class BiliQuery {
449
453
  `\n--------------------`,
450
454
  `\n投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
451
455
  `\n--------------------`,
452
- `\n${formatNumber(module_stat?.like?.count)}点赞 • ${formatNumber(module_stat?.comment?.count)}评论 • ${formatNumber(module_stat?.forward?.count)}转发`,
453
- `\n--------------------`,
454
- `\n链接:${BiliDrawDynamicLinkUrl}${data.id_str}\n`
456
+ ...(module_stat
457
+ ? [
458
+ `\n${formatNumber(module_stat.like?.count)}点赞 • ${formatNumber(module_stat.comment?.count)}评论 • ${formatNumber(module_stat.forward?.count)}转发\n--------------------`
459
+ ]
460
+ : []),
461
+ `\n链接:${BiliDrawDynamicLinkUrl}${data.id_str}`
455
462
  ];
456
463
  return { msg, pics, dynamicType };
457
464
  case 'DYNAMIC_TYPE_DRAW':
@@ -492,7 +499,7 @@ class BiliQuery {
492
499
  pics = pics.map((item) => {
493
500
  return Segment.image(item);
494
501
  });
495
- msg_meta = `B站【${upName}】图文动态推送:\n`;
502
+ msg_meta = `B站【${upName}】图文动态推送:`;
496
503
  msg = [
497
504
  msg_meta,
498
505
  `\n--------------------`,
@@ -501,8 +508,11 @@ class BiliQuery {
501
508
  `\n--------------------`,
502
509
  `\n投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
503
510
  `\n--------------------`,
504
- `\n${formatNumber(module_stat?.like?.count)}点赞 • ${formatNumber(module_stat?.comment?.count)}评论 • ${formatNumber(module_stat?.forward?.count)}转发`,
505
- `\n--------------------`,
511
+ ...(module_stat
512
+ ? [
513
+ `\n${formatNumber(module_stat.like?.count)}点赞 • ${formatNumber(module_stat.comment?.count)}评论 • ${formatNumber(module_stat.forward?.count)}转发\n--------------------`
514
+ ]
515
+ : []),
506
516
  `\n链接:${BiliDrawDynamicLinkUrl}${data.id_str}`
507
517
  ];
508
518
  return { msg, pics, dynamicType };
@@ -541,7 +551,7 @@ class BiliQuery {
541
551
  pics = pics.map((item) => {
542
552
  return Segment.image(item);
543
553
  });
544
- msg_meta = `B站【${upName}】文章动态推送:\n`;
554
+ msg_meta = `B站【${upName}】文章动态推送:`;
545
555
  msg = [
546
556
  msg_meta,
547
557
  `\n--------------------`,
@@ -552,8 +562,11 @@ class BiliQuery {
552
562
  `\n--------------------`,
553
563
  `\n投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
554
564
  `\n--------------------`,
555
- `\n${formatNumber(module_stat?.like?.count)}点赞 • ${formatNumber(module_stat?.comment?.count)}评论 • ${formatNumber(module_stat?.forward?.count)}转发`,
556
- `\n--------------------`,
565
+ ...(module_stat
566
+ ? [
567
+ `\n${formatNumber(module_stat.like?.count)}点赞 • ${formatNumber(module_stat.comment?.count)}评论 • ${formatNumber(module_stat.forward?.count)}转发\n--------------------`
568
+ ]
569
+ : []),
557
570
  `\n链接:${this.formatUrl(desc.jump_url)}`
558
571
  ];
559
572
  return { msg, pics, dynamicType };
@@ -577,7 +590,7 @@ class BiliQuery {
577
590
  else {
578
591
  return 'continue';
579
592
  }
580
- msg_meta = `B站【${upName}】转发动态推送:\n`;
593
+ msg_meta = `B站【${upName}】转发动态推送:`;
581
594
  msg = [
582
595
  msg_meta,
583
596
  `\n--------------------`,
@@ -586,8 +599,11 @@ class BiliQuery {
586
599
  `\n--------------------`,
587
600
  `\n投稿:${author ? moment(author.pub_ts * 1000).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
588
601
  `\n--------------------`,
589
- `\n${formatNumber(module_stat?.like?.count)}点赞 • ${formatNumber(module_stat?.comment?.count)}评论 • ${formatNumber(module_stat?.forward?.count)}转发`,
590
- `\n--------------------`,
602
+ ...(module_stat
603
+ ? [
604
+ `\n${formatNumber(module_stat.like?.count)}点赞 • ${formatNumber(module_stat.comment?.count)}评论 • ${formatNumber(module_stat.forward?.count)}转发\n--------------------`
605
+ ]
606
+ : []),
591
607
  `\n链接:${BiliDrawDynamicLinkUrl}${data.id_str}\n`,
592
608
  '\n>>>>以下为转发内容<<<<\n',
593
609
  ...origContent
@@ -602,7 +618,7 @@ class BiliQuery {
602
618
  desc = desc?.live_play_info;
603
619
  if (!desc)
604
620
  return;
605
- msg_meta = `B站【${upName}】直播动态推送:\n`;
621
+ msg_meta = `B站【${upName}】直播动态推送:`;
606
622
  msg = [
607
623
  msg_meta,
608
624
  `\n--------------------`,
@@ -210,7 +210,7 @@ class WeiboQuery {
210
210
  /**动态发布时间 */
211
211
  let created_time = this.getDynamicCreatetDate(raw_post);
212
212
  let detail_url = `https://weibo.com/${info?.user?.id}/${info?.bid}`;
213
- let msg_meta = `微博【${upName}】动态推送:\n`;
213
+ let msg_meta = `微博【${upName}】动态推送:`;
214
214
  const dynamicPicCountLimit = setData.pushPicCountLimit || 3;
215
215
  function formatNumber(num) {
216
216
  if (num >= 10000) {
@@ -228,7 +228,7 @@ class WeiboQuery {
228
228
  const temp = Segment.image(pic_url, false, 15000, { referer: 'https://weibo.com' });
229
229
  pics.push(temp);
230
230
  }
231
- msg_meta = `微博【${upName}】视频动态推送:\n`;
231
+ msg_meta = `微博【${upName}】视频动态推送:`;
232
232
  msg = [
233
233
  msg_meta,
234
234
  `\n--------------------`,
@@ -239,8 +239,11 @@ class WeiboQuery {
239
239
  `\n--------------------`,
240
240
  `\n投稿:${created_time ? moment(created_time).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
241
241
  `\n--------------------`,
242
- `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 ${formatNumber(info?.reposts_count)}转发 `,
243
- `\n--------------------`,
242
+ ...(info?.comments_count != null
243
+ ? [
244
+ `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 • ${formatNumber(info?.reposts_count)}转发\n--------------------`
245
+ ]
246
+ : []),
244
247
  `\n链接:${detail_url}`
245
248
  ];
246
249
  return { msg, pics, dynamicType };
@@ -255,7 +258,7 @@ class WeiboQuery {
255
258
  const temp = Segment.image(pic_url, false, 15000, { referer: 'https://weibo.com' });
256
259
  pics.push(temp);
257
260
  }
258
- msg_meta = `微博【${upName}】图文动态推送:\n`;
261
+ msg_meta = `微博【${upName}】图文动态推送:`;
259
262
  msg = [
260
263
  msg_meta,
261
264
  `\n--------------------`,
@@ -264,8 +267,11 @@ class WeiboQuery {
264
267
  `\n--------------------`,
265
268
  `\n投稿:${created_time ? moment(created_time).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
266
269
  `\n--------------------`,
267
- `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 ${formatNumber(info?.reposts_count)}转发 `,
268
- `\n--------------------`,
270
+ ...(info?.comments_count != null
271
+ ? [
272
+ `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 • ${formatNumber(info?.reposts_count)}转发\n--------------------`
273
+ ]
274
+ : []),
269
275
  `\n链接:${detail_url}`
270
276
  ];
271
277
  return { msg, pics, dynamicType };
@@ -280,7 +286,7 @@ class WeiboQuery {
280
286
  const temp = Segment.image(pic_url, false, 15000, { referer: 'https://weibo.com' });
281
287
  pics.push(temp);
282
288
  }
283
- msg_meta = `微博【${upName}】文章动态推送:\n`;
289
+ msg_meta = `微博【${upName}】文章动态推送:`;
284
290
  msg = [
285
291
  msg_meta,
286
292
  `\n--------------------`,
@@ -289,8 +295,11 @@ class WeiboQuery {
289
295
  `\n--------------------`,
290
296
  `\n投稿:${created_time ? moment(created_time).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
291
297
  `\n--------------------`,
292
- `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 ${formatNumber(info?.reposts_count)}转发 `,
293
- `\n--------------------`,
298
+ ...(info?.comments_count != null
299
+ ? [
300
+ `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 • ${formatNumber(info?.reposts_count)}转发\n--------------------`
301
+ ]
302
+ : []),
294
303
  `\n链接:${detail_url}`
295
304
  ];
296
305
  return { msg, pics, dynamicType };
@@ -310,7 +319,7 @@ class WeiboQuery {
310
319
  else {
311
320
  return 'continue';
312
321
  }
313
- msg_meta = `微博【${upName}】转发动态推送:\n`;
322
+ msg_meta = `微博【${upName}】转发动态推送:`;
314
323
  msg = [
315
324
  msg_meta,
316
325
  `\n--------------------`,
@@ -319,8 +328,11 @@ class WeiboQuery {
319
328
  `\n--------------------`,
320
329
  `\n投稿:${created_time ? moment(created_time).format('YYYY年MM月DD日 HH:mm:ss') : ''}`,
321
330
  `\n--------------------`,
322
- `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 ${formatNumber(info?.reposts_count)}转发 `,
323
- `\n--------------------`,
331
+ ...(info?.comments_count != null
332
+ ? [
333
+ `\n${formatNumber(info?.attitudes_count)}点赞 • ${formatNumber(info?.comments_count)}评论 • ${formatNumber(info?.reposts_count)}转发\n--------------------`
334
+ ]
335
+ : []),
324
336
  `\n链接:${detail_url}\n`,
325
337
  '\n>>>>以下为转发内容<<<<\n',
326
338
  ...origContent
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yz-yuki-plugin",
3
- "version": "2.0.7-15",
3
+ "version": "2.0.7-17",
4
4
  "description": "优纪插件,yunzaijs 关于 微博推送、B站推送 等功能的拓展插件",
5
5
  "author": "snowtafir",
6
6
  "type": "module",