koztv-blog-tools 1.2.6 → 1.2.8

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/dist/index.d.mts CHANGED
@@ -189,6 +189,7 @@ interface ExportedPost {
189
189
  link: string;
190
190
  channelUsername: string;
191
191
  channelTitle: string;
192
+ replyToMsgId?: number;
192
193
  }
193
194
  interface ExportResult {
194
195
  channelMeta: {
package/dist/index.d.ts CHANGED
@@ -189,6 +189,7 @@ interface ExportedPost {
189
189
  link: string;
190
190
  channelUsername: string;
191
191
  channelTitle: string;
192
+ replyToMsgId?: number;
192
193
  }
193
194
  interface ExportResult {
194
195
  channelMeta: {
package/dist/index.js CHANGED
@@ -575,6 +575,10 @@ async function exportTelegramChannel(options) {
575
575
  }
576
576
  const content = entitiesToMarkdown(message.message || "", message.entities);
577
577
  const link = channelMeta.username ? `https://t.me/${channelMeta.username}/${msgId}` : "";
578
+ let replyToMsgId;
579
+ if (message.replyTo && "replyToMsgId" in message.replyTo) {
580
+ replyToMsgId = message.replyTo.replyToMsgId;
581
+ }
578
582
  const post = {
579
583
  msgId,
580
584
  date: new Date(message.date * 1e3),
@@ -585,7 +589,8 @@ async function exportTelegramChannel(options) {
585
589
  forwards: message.forwards,
586
590
  link,
587
591
  channelUsername: channelMeta.username,
588
- channelTitle: channelMeta.title
592
+ channelTitle: channelMeta.title,
593
+ replyToMsgId
589
594
  };
590
595
  posts.push(post);
591
596
  const markdown = formatPostMarkdown(post);
@@ -618,6 +623,10 @@ views: ${post.views}`;
618
623
  if (post.forwards !== void 0) {
619
624
  frontmatter += `
620
625
  forwards: ${post.forwards}`;
626
+ }
627
+ if (post.replyToMsgId !== void 0) {
628
+ frontmatter += `
629
+ reply_to_msg_id: ${post.replyToMsgId}`;
621
630
  }
622
631
  frontmatter += "\n---\n\n";
623
632
  let body = post.content || "";
@@ -813,12 +822,14 @@ async function processPost(post, options, exportDir) {
813
822
  }
814
823
  }
815
824
  }
825
+ const replyLine = post.replyToMsgId ? `reply_to_msg_id: ${post.replyToMsgId}
826
+ ` : "";
816
827
  const markdown = `---
817
828
  title: "${title.replace(/"/g, '\\"')}"
818
829
  date: ${date}
819
830
  lang: ${lang}
820
831
  original_link: "${post.link || ""}"
821
- ${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
832
+ ${replyLine}${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
822
833
  `}---
823
834
 
824
835
  ${finalBody}
package/dist/index.mjs CHANGED
@@ -518,6 +518,10 @@ async function exportTelegramChannel(options) {
518
518
  }
519
519
  const content = entitiesToMarkdown(message.message || "", message.entities);
520
520
  const link = channelMeta.username ? `https://t.me/${channelMeta.username}/${msgId}` : "";
521
+ let replyToMsgId;
522
+ if (message.replyTo && "replyToMsgId" in message.replyTo) {
523
+ replyToMsgId = message.replyTo.replyToMsgId;
524
+ }
521
525
  const post = {
522
526
  msgId,
523
527
  date: new Date(message.date * 1e3),
@@ -528,7 +532,8 @@ async function exportTelegramChannel(options) {
528
532
  forwards: message.forwards,
529
533
  link,
530
534
  channelUsername: channelMeta.username,
531
- channelTitle: channelMeta.title
535
+ channelTitle: channelMeta.title,
536
+ replyToMsgId
532
537
  };
533
538
  posts.push(post);
534
539
  const markdown = formatPostMarkdown(post);
@@ -561,6 +566,10 @@ views: ${post.views}`;
561
566
  if (post.forwards !== void 0) {
562
567
  frontmatter += `
563
568
  forwards: ${post.forwards}`;
569
+ }
570
+ if (post.replyToMsgId !== void 0) {
571
+ frontmatter += `
572
+ reply_to_msg_id: ${post.replyToMsgId}`;
564
573
  }
565
574
  frontmatter += "\n---\n\n";
566
575
  let body = post.content || "";
@@ -756,12 +765,14 @@ async function processPost(post, options, exportDir) {
756
765
  }
757
766
  }
758
767
  }
768
+ const replyLine = post.replyToMsgId ? `reply_to_msg_id: ${post.replyToMsgId}
769
+ ` : "";
759
770
  const markdown = `---
760
771
  title: "${title.replace(/"/g, '\\"')}"
761
772
  date: ${date}
762
773
  lang: ${lang}
763
774
  original_link: "${post.link || ""}"
764
- ${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
775
+ ${replyLine}${isOriginal ? "" : `translated_from: "${translate?.sourceLang || "ru"}"
765
776
  `}---
766
777
 
767
778
  ${finalBody}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koztv-blog-tools",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "Shared utilities for Telegram-based blog sites",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",