Skip to content

Commit

Permalink
fixed weffiuhw23j93oi[jwrecsdr3r9032ejdwelkmkrf3po
Browse files Browse the repository at this point in the history
  • Loading branch information
raluvy95 committed Jun 10, 2023
1 parent d4a7c0e commit e6e4b39
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/utils/reddit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export function parseToEmbed(children: Data2) {
children.thumbnail.startsWith("http")
) {
e.setThumb(children.thumbnail);
} else {
e.setImage(children.url);
} else if (children.url.startsWith("http")) {
e.setImage(children.url)
}
if (children.media_metadata) {
e.setImage(Object.values(children.media_metadata)[0].p[0].u);
Expand All @@ -76,5 +76,11 @@ export function parseToEmbed(children: Data2) {
e.setDesc(`[Click to see video](${children.url})`);
}

if ((children as Data2 & { crosspost_parent_list?: Array<any> }).crosspost_parent_list?.length) {
e.setDesc(`[Crosspost](${(children as Data2 & { crosspost_parent_list: Array<any> }).crosspost_parent_list[0].url})`)
}

console.log(children)

return e;
}

0 comments on commit e6e4b39

Please sign in to comment.