Added max comment length variable in env

pull/334/head
Riccardo Benedetti 3 years ago
parent cf6b3a9c44
commit b03089def0

@ -16,5 +16,8 @@ THEME=""
# Enter a subreddit, e.g. "AskReddit"
SUBREDDIT=""
# Max reddit comments length in characters e.g. "100"
MAX_COMMENT_LEN="100"
# Range is 0 -> 1
OPACITY="0.9"

@ -1,3 +1,4 @@
from email.mime import base
from rich.console import Console
from utils.console import print_markdown, print_step, print_substep
from dotenv import load_dotenv
@ -67,13 +68,14 @@ def get_subreddit_threads():
for top_level_comment in submission.comments:
if not top_level_comment.stickied:
content["comments"].append(
{
"comment_body": top_level_comment.body,
"comment_url": top_level_comment.permalink,
"comment_id": top_level_comment.id,
}
)
if len(top_level_comment.body) <= int(os.getenv("MAX_COMMENT_LEN")):
content["comments"].append(
{
"comment_body": top_level_comment.body,
"comment_url": top_level_comment.permalink,
"comment_id": top_level_comment.id,
}
)
except AttributeError as e:
pass

Loading…
Cancel
Save