Skip to content

Commit

Permalink
fix(quote): prevent quoting unavailable tweet
Browse files Browse the repository at this point in the history
  • Loading branch information
louisgrasset committed Nov 19, 2023
1 parent 5874e80 commit c543b12
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/helpers/tweet/keep-self-quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import { Tweet } from "@the-convocation/twitter-scraper";
import { TWITTER_HANDLE } from "../../constants.js";

export const keepSelfQuotes = async (tweet: Tweet) => {
if (tweet.quotedStatus) {
return tweet.quotedStatus.username === TWITTER_HANDLE;
if (tweet.isQuoted) {
return tweet.quotedStatus
? tweet.quotedStatus.username === TWITTER_HANDLE // If the quoted tweet is from the same user, keep it.
: false; // If the quoted tweet is not available, skip the tweet.
}

// True by default so chained conditions works
Expand Down

0 comments on commit c543b12

Please sign in to comment.