Mike L 4 лет назад
Родитель
Сommit
beb40c5221
2 измененных файлов с 14 добавлено и 4 удалено
  1. 7 2
      dist/command.js
  2. 7 2
      src/command.ts

+ 7 - 2
dist/command.js

@@ -81,12 +81,17 @@ https://www.instagram.com/p/B6GHRSmgV-7/`);
     };
     const newSub = (userName) => {
         const link = twitter_1.linkBuilder(matched);
-        subscribeTo(link, { id: Number(userName.split(':')[1]) });
+        let msg;
+        if (offset !== '0') {
+            msg = `已为此聊天订阅 ${link} 并回溯到 ${args[0].replace(/\?.*/, '')}(含)之后的第一条动态`;
+        }
+        return subscribeTo(link, { id: Number(userName.split(':')[1]), msg });
     };
     if (matched.postUrlSegment) {
         offset = utils_1.BigNumOps.plus(twitter_1.urlSegmentToId(matched.postUrlSegment), '-1');
-        delete matched.postUrlSegment;
         twitter_1.getPostOwner(matched.postUrlSegment).then(userName => {
+            delete matched.postUrlSegment;
+            matched.userName = userName.split(':')[0];
             if (!tryFindSub(userName))
                 newSub(userName);
         }).catch((parsedErr) => {

+ 7 - 2
src/command.ts

@@ -90,12 +90,17 @@ https://www.instagram.com/p/B6GHRSmgV-7/`);
   };
   const newSub = (userName: string) => {
     const link = linkBuilder(matched);
-    subscribeTo(link, {id: Number(userName.split(':')[1])});
+    let msg: string;
+    if (offset !== '0') {
+      msg = `已为此聊天订阅 ${link} 并回溯到 ${args[0].replace(/\?.*/, '')}(含)之后的第一条动态`;
+    }
+    return subscribeTo(link, {id: Number(userName.split(':')[1]), msg});
   };
   if (matched.postUrlSegment) {
     offset = BigNumOps.plus(urlSegmentToId(matched.postUrlSegment), '-1');
-    delete matched.postUrlSegment;
     getPostOwner(matched.postUrlSegment).then(userName => {
+      delete matched.postUrlSegment;
+      matched.userName = userName.split(':')[0];
       if (!tryFindSub(userName)) newSub(userName);
     }).catch((parsedErr: Error) => {
       reply(parsedErr.message);