Updated the .env.template to be a little easier to deal with.

This commit is contained in:
Lewis Menelaws committed 2022-06-02 14:11:32 -04:00
1 parent 4f4616a49f
commit 9bb116793a
2 files changed
+7 -9

No files matched your search

+1 -1
View File
@@ -2,5 +2,5 @@ REDDIT_CLIENT_ID=""
REDDIT_CLIENT_SECRET=""
REDDIT_USERNAME=""
REDDIT_PASSWORD=""
ASK_EACH_TIME="TRUE"
SUBREDDIT=""
+6 -8
View File
@@ -22,16 +22,14 @@ def get_subreddit_threads():
password=os.getenv("REDDIT_PASSWORD"),
)
if os.getenv("ASK_EACH_TIME") == "TRUE":
try:
subreddit = reddit.subreddit(input("What subreddit would you like to pull from? "))
except ValueError:
subreddit = reddit.subreddit("askreddit")
print_substep("Subreddit not defined. Using AskReddit.")
if os.getenv("SUBREDDIT"):
subreddit = reddit.subreddit(os.getenv("SUBREDDIT"))
else:
# ! Prompt the user to enter a subreddit
try:
subreddit = reddit.subreddit(os.getenv("SUBREDDIT"))
print_substep(f"Using subreddit {os.getenv('SUBREDDIT')}")
subreddit = reddit.subreddit(
input("What subreddit would you like to pull from? ")
)
except ValueError:
subreddit = reddit.subreddit("askreddit")
print_substep("Subreddit not defined. Using AskReddit.")