Skip to content

Commit

Permalink
Update TwitterRecord.discord_embed to handle retweet of quote correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
user committed Jun 12, 2024
1 parent bde11b4 commit a33a4c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions avtdl/plugins/twitter/extractors.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ def __str__(self):
return '\n'.join(elements)

def discord_embed(self) -> List[dict]:
quote = self.quote if self.retweet is None else self.retweet.quote

text_items = [self.text]
if len(self.attachments) > 1:
text_items.extend(self.attachments)
if self.quote:
if quote:
text_items.append('\nReferring to ')
text_items.append(str(self.quote))
text_items.append(str(quote))
text = '\n'.join(text_items)

if self.retweet is not None:
Expand Down Expand Up @@ -110,8 +112,8 @@ def format_attachments(post_url: str, attachments: List[str]) -> List[dict]:
images = format_attachments(self.url, self.attachments)
embed['image'] = images.pop(0)['image']
embeds = [embed, *images]
elif self.quote and self.quote.attachments:
images = format_attachments(self.quote.url, self.quote.attachments)
elif quote and quote.attachments:
images = format_attachments(quote.url, quote.attachments)
embed['image'] = images.pop(0)['image']
embeds = [embed, *images]
else:
Expand Down

0 comments on commit a33a4c0

Please sign in to comment.