feat: allows the subreddit choice to begin with r/

pull/790/head
Jason 3 years ago
parent f2c1d7de26
commit 33a66b0ae3

@ -57,8 +57,11 @@ def get_subreddit_threads():
print_substep( print_substep(
f"Using subreddit: r/{getenv('SUBREDDIT')} from environment variable config" f"Using subreddit: r/{getenv('SUBREDDIT')} from environment variable config"
) )
subreddit_choice = getenv("SUBREDDIT")
if subreddit_choice.casefold().startswith('r/'): # removes the r/ from the input
subreddit_choice = subreddit_choice[2:]
subreddit = reddit.subreddit( subreddit = reddit.subreddit(
getenv("SUBREDDIT") subreddit_choice
) # Allows you to specify in .env. Done for automation purposes. ) # Allows you to specify in .env. Done for automation purposes.
if getenv("POST_ID"): if getenv("POST_ID"):

Loading…
Cancel
Save