|
@@ -245,8 +245,9 @@ class default_1 {
|
|
}
|
|
}
|
|
}))
|
|
}))
|
|
.finally(() => Object.values(this.lock.threads).forEach(thread => {
|
|
.finally(() => Object.values(this.lock.threads).forEach(thread => {
|
|
- if (userIds.includes(thread.id))
|
|
|
|
- thread.updatedAt = new Date().toString();
|
|
|
|
|
|
+ if (userIds.includes(thread.id)) {
|
|
|
|
+ thread.updatedAt = (this.cache[idToUserMap[thread.id].username].updated = new Date()).toString();
|
|
|
|
+ }
|
|
}));
|
|
}));
|
|
}), (lp1, lp2) => () => lp1().then(() => util_1.promisify(setTimeout)(this.workInterval * 1000).then(lp2)));
|
|
}), (lp1, lp2) => () => lp1().then(() => util_1.promisify(setTimeout)(this.workInterval * 1000).then(lp2)));
|
|
})
|
|
})
|
|
@@ -360,8 +361,10 @@ class default_1 {
|
|
const sender = this.sendStories(`instagram stories for ${rawUserName}`, receiver);
|
|
const sender = this.sendStories(`instagram stories for ${rawUserName}`, receiver);
|
|
this.queryUser(rawUserName)
|
|
this.queryUser(rawUserName)
|
|
.then(userNameId => {
|
|
.then(userNameId => {
|
|
|
|
+ var _a, _b;
|
|
const [userName, userId] = userNameId.split(':');
|
|
const [userName, userId] = userNameId.split(':');
|
|
- if (userName in this.cache && Object.keys(this.cache[userName].stories).length > 0) {
|
|
|
|
|
|
+ if (Date.now() - ((_b = (_a = this.cache[userName]) === null || _a === void 0 ? void 0 : _a.updated) === null || _b === void 0 ? void 0 : _b.getTime()) > this.workInterval * 10000 &&
|
|
|
|
+ Object.keys(this.cache[userName].stories).length > 0) {
|
|
return Promise.resolve(Object.values(this.cache[userName].stories)
|
|
return Promise.resolve(Object.values(this.cache[userName].stories)
|
|
.map(story => (Object.assign(Object.assign({}, story), { user: this.cache[userName].user })))
|
|
.map(story => (Object.assign(Object.assign({}, story), { user: this.cache[userName].user })))
|
|
.sort((i1, i2) => utils_1.BigNumOps.compare(i2.pk, i1.pk)));
|
|
.sort((i1, i2) => utils_1.BigNumOps.compare(i2.pk, i1.pk)));
|
|
@@ -374,6 +377,7 @@ class default_1 {
|
|
this.cache[userName].stories[item.pk] = item;
|
|
this.cache[userName].stories[item.pk] = item;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ this.cache[userName].updated = new Date();
|
|
if (storyItems.length === 0)
|
|
if (storyItems.length === 0)
|
|
this.bot.sendTo(receiver, `当前用户 (@${userName}) 没有可用的推特故事。`);
|
|
this.bot.sendTo(receiver, `当前用户 (@${userName}) 没有可用的推特故事。`);
|
|
return storyItems;
|
|
return storyItems;
|