Kaynağa Gözat

make rewind syntax more semantic

Mike L 3 yıl önce
ebeveyn
işleme
c931fe379a
4 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 2 2
      dist/command.js
  2. 1 1
      dist/twitter.js
  3. 2 2
      src/command.ts
  4. 1 1
      src/twitter.ts

+ 2 - 2
dist/command.js

@@ -178,10 +178,10 @@ function view(chat, args, reply) {
 https://twitter.com/TomoyoKurosawa/status/1486136914864345092
 1486136914864345092
 last@TomoyoKurosawa
-last-2@sunflower930316,noreps=off,norts=on
+last-1@sunflower930316,noreps=off,norts=on
 (表达式筛选参数详见 /help twitter_query)`);
     }
-    if (Math.abs(Number(match[2])) > 50) {
+    if (Math.abs(Number(match[2])) >= 50) {
         return reply('表达式中指定的回溯数量超出取值范围。');
     }
     let forceRefresh;

+ 1 - 1
dist/twitter.js

@@ -327,7 +327,7 @@ class default_1 {
             const match = /^last(|-\d+)@([^\/?#,]+)((?:,no.*?=[^,]*)*)$/.exec(idOrQuery);
             const query = () => this.queryTimeline({
                 username: match[2],
-                count: 0 - Number(match[1] || -1),
+                count: 1 - Number(match[1]),
                 noreps: { on: true, off: false }[match[3].replace(/.*,noreps=([^,]*).*/, '$1')],
                 norts: { on: true, off: false }[match[3].replace(/.*,norts=([^,]*).*/, '$1')],
             }).then(tweets => tweets.slice(-1)[0].id_str);

+ 2 - 2
src/command.ts

@@ -190,10 +190,10 @@ function view(chat: IChat, args: string[], reply: (msg: string) => any): void {
 https://twitter.com/TomoyoKurosawa/status/1486136914864345092
 1486136914864345092
 last@TomoyoKurosawa
-last-2@sunflower930316,noreps=off,norts=on
+last-1@sunflower930316,noreps=off,norts=on
 (表达式筛选参数详见 /help twitter_query)`);
   }
-  if (Math.abs(Number(match[2])) > 50) {
+  if (Math.abs(Number(match[2])) >= 50) {
     return reply('表达式中指定的回溯数量超出取值范围。');
   }
   let forceRefresh: boolean;

+ 1 - 1
src/twitter.ts

@@ -159,7 +159,7 @@ export default class {
       const match = /^last(|-\d+)@([^\/?#,]+)((?:,no.*?=[^,]*)*)$/.exec(idOrQuery);
       const query = () => this.queryTimeline({
           username: match[2],
-          count: 0 - Number(match[1] || -1),
+          count: 1 - Number(match[1]),
           noreps: {on: true, off: false}[match[3].replace(/.*,noreps=([^,]*).*/, '$1')],
           norts: {on: true, off: false}[match[3].replace(/.*,norts=([^,]*).*/, '$1')],
         }).then(tweets => tweets.slice(-1)[0].id_str);