|
@@ -385,20 +385,18 @@ ${Object.keys(cachedFeed.stories).some(id => id > topOfFeed) ? `\n下次推送
|
|
|
return this.client.feed.reelsMedia({ userIds: [userId] }).items()
|
|
|
.then(storyItems => Promise.all(storyItems
|
|
|
.filter(item => !(item.pk in this.cache[userName].stories))
|
|
|
- .map(item => this.webshot([Object.assign(Object.assign({}, item), { user: this.cache[userName].user })], (msgs, text, author) => this.cache[userName].stories[item.pk] = { pk: item.pk, msgs, text, author, original: item }, this.webshotDelay))).then(() => userName)
|
|
|
- .finally(() => {
|
|
|
- this.cache[userName].updated = new Date();
|
|
|
- if (storyItems.length === 0)
|
|
|
- this.bot.sendTo(receiver, `当前用户 (@${userName}) 没有可用的 Instagram 限时动态。`);
|
|
|
- }));
|
|
|
+ .map(item => this.webshot([Object.assign(Object.assign({}, item), { user: this.cache[userName].user })], (msgs, text, author) => this.cache[userName].stories[item.pk] = { pk: item.pk, msgs, text, author, original: item }, this.webshotDelay))).then(() => userName).finally(() => this.cache[userName].updated = new Date()));
|
|
|
})
|
|
|
.then(userName => {
|
|
|
const storyItems = Object.values(this.cache[userName].stories)
|
|
|
.sort((i1, i2) => -utils_1.BigNumOps.compare(i2.pk, i1.pk));
|
|
|
+ if (storyItems.length === 0)
|
|
|
+ return this.bot.sendTo(receiver, `当前用户 (@${userName}) 没有可用的 Instagram 限时动态。`);
|
|
|
if (startIndex + 1 > storyItems.length)
|
|
|
return this.bot.sendTo(receiver, '跳过数量到达或超过当前用户可用的限时动态数量。');
|
|
|
- const sendRangeText = `${startIndex + 1}${count > 1 ? `-${Math.min(storyItems.length, startIndex + count)}` : ''}`;
|
|
|
- return this.workOnMedia(storyItems.slice(startIndex, startIndex + count), sender)
|
|
|
+ const endIndex = Math.min(storyItems.length, startIndex + count);
|
|
|
+ const sendRangeText = `${startIndex + 1}${endIndex - startIndex > 1 ? `-${endIndex}` : ''}`;
|
|
|
+ return this.workOnMedia(storyItems.slice(startIndex, endIndex), sender)
|
|
|
.then(() => this.bot.sendTo(receiver, `已显示当前用户 ${storyItems.length} 条可用限时动态中的第 ${sendRangeText} 条。`));
|
|
|
})
|
|
|
.catch((error) => {
|