Fix reddit checking for crosspost
This commit is contained in:
parent
1b05cc3b13
commit
488234ba79
2 changed files with 7 additions and 2 deletions
|
@ -42,7 +42,7 @@ async def post_embeds(sub: Sub, post: Submission, reddit: Reddit) -> Optional[Li
|
||||||
fields = []
|
fields = []
|
||||||
content = ""
|
content = ""
|
||||||
og_post = None
|
og_post = None
|
||||||
if not post.is_self:
|
if "crosspost_parent_list" in vars(post):
|
||||||
og_post = post # noqa: F841
|
og_post = post # noqa: F841
|
||||||
post = await reddit.submission(post.crosspost_parent_list[0]["id"])
|
post = await reddit.submission(post.crosspost_parent_list[0]["id"])
|
||||||
await post.load()
|
await post.load()
|
||||||
|
@ -62,9 +62,14 @@ async def post_embeds(sub: Sub, post: Submission, reddit: Reddit) -> Optional[Li
|
||||||
break
|
break
|
||||||
|
|
||||||
if "selftext" in vars(post) and post.selftext:
|
if "selftext" in vars(post) and post.selftext:
|
||||||
|
text = post.selftext
|
||||||
|
if post.spoiler:
|
||||||
|
text = "||" + text + "||"
|
||||||
content += "\n\n" + post.selftext
|
content += "\n\n" + post.selftext
|
||||||
if len(content) > 900:
|
if len(content) > 900:
|
||||||
content = content[:900] + "..."
|
content = content[:900] + "..."
|
||||||
|
if post.spoiler:
|
||||||
|
content += "||"
|
||||||
content += f"\n\n[View this post]({url})"
|
content += f"\n\n[View this post]({url})"
|
||||||
|
|
||||||
if not images and not content:
|
if not images and not content:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "jarvis-tasks"
|
name = "jarvis-tasks"
|
||||||
version = "0.7.0"
|
version = "0.7.1"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Your Name <you@example.com>"]
|
authors = ["Your Name <you@example.com>"]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue