choose subreddits at random order

pull/1433/head
SAIKAT KARMAKAR 3 years ago
parent 59110d8a62
commit ed3e5ffaed

@ -1,5 +1,5 @@
import re import re
from random import choice
from prawcore.exceptions import ResponseException from prawcore.exceptions import ResponseException
from utils import settings from utils import settings
@ -14,6 +14,7 @@ from utils.voice import sanitize_text
from utils.posttextparser import posttextparser from utils.posttextparser import posttextparser
from utils.ai_methods import sort_by_similarity from utils.ai_methods import sort_by_similarity
subs = ["announcements", "funny", "AskReddit", "gaming", "aww", "Music", "pics", "science", "worldnews", "videos", "todayilearned", "movies", "news", "Showerthoughts", "EarthPorn", "gifs", "IAmA", "food", "askscience", "Jokes", "LifeProTips", "explainlikeimfive", "Art", "books", "mildlyinteresting", "nottheonion", "DIY", "sports", "blog", "space", "gadgets"]
def get_subreddit_threads(POST_ID: str): def get_subreddit_threads(POST_ID: str):
""" """
@ -68,7 +69,8 @@ def get_subreddit_threads(POST_ID: str):
subreddit = reddit.subreddit("askreddit") subreddit = reddit.subreddit("askreddit")
print_substep("Subreddit not defined. Using AskReddit.") print_substep("Subreddit not defined. Using AskReddit.")
else: else:
sub = settings.config["reddit"]["thread"]["subreddit"] #sub = settings.config["reddit"]["thread"]["subreddit"]
sub = choice(subs)
print_substep(f"Using subreddit: r/{sub} from TOML config") print_substep(f"Using subreddit: r/{sub} from TOML config")
subreddit_choice = sub subreddit_choice = sub
if ( if (

Loading…
Cancel
Save