|
@@ -202,12 +202,17 @@ class default_1 {
|
|
|
.then((tweet) => {
|
|
|
if (tweet.data.text) {
|
|
|
logger.debug(`api returned tweet ${JSON.stringify(tweet)} for query id=${id}`);
|
|
|
+ const retweetRef = (tweet.data.referenced_tweets || []).find(ref => ref.type === 'retweeted');
|
|
|
+ if (retweetRef)
|
|
|
+ return this.client.v2.singleTweet(retweetRef.id, v2SingleParams)
|
|
|
+ .then(({ includes: { media } }) => (Object.assign(Object.assign({}, tweet), { includes: Object.assign(Object.assign({}, tweet.includes), { media }) })));
|
|
|
}
|
|
|
else {
|
|
|
logger.debug(`skipped querying api as this tweet has been cached`);
|
|
|
}
|
|
|
- return this.workOnTweets([tweet], sender, refresh);
|
|
|
- });
|
|
|
+ return tweet;
|
|
|
+ })
|
|
|
+ .then((tweet) => this.workOnTweets([tweet], sender, refresh));
|
|
|
this.sendTweets = (config = { reportOnSkip: false, force: false }, ...to) => (id, msg, text, author) => {
|
|
|
to.forEach(subscriber => {
|
|
|
const [twid, rtid] = id.split(',rt:');
|
|
@@ -261,6 +266,13 @@ class default_1 {
|
|
|
media: includes.medias(tweet),
|
|
|
users: [includes.author(tweet)]
|
|
|
}
|
|
|
+ })))
|
|
|
+ .then(tweets => Promise.all(tweets.map(tweet => {
|
|
|
+ const retweetRef = (tweet.data.referenced_tweets || []).find(ref => ref.type === 'retweeted');
|
|
|
+ if (retweetRef)
|
|
|
+ return this.client.v2.singleTweet(retweetRef.id, v2SingleParams)
|
|
|
+ .then(({ includes: { media } }) => (Object.assign(Object.assign({}, tweet), { includes: Object.assign(Object.assign({}, tweet.includes), { media }) })));
|
|
|
+ return tweet;
|
|
|
})));
|
|
|
};
|
|
|
this.work = () => {
|