Initial commit
This commit is contained in:
14
config.py
Normal file
14
config.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# config.py
|
||||
# Fetches config from subreddit wiki page
|
||||
import json
|
||||
|
||||
def fetch_config_from_wiki(reddit, subreddit_name, wiki_page):
|
||||
subreddit = reddit.subreddit(subreddit_name)
|
||||
try:
|
||||
wiki = subreddit.wiki[wiki_page]
|
||||
config_text = wiki.content_md
|
||||
config = json.loads(config_text)
|
||||
return config
|
||||
except Exception as e:
|
||||
print(f"Error fetching config from wiki: {e}")
|
||||
return {'posts': []}
|
||||
Reference in New Issue
Block a user