create default config if it doesn't exist
This commit is contained in:
@@ -1,9 +1,35 @@
|
|||||||
import praw
|
import praw
|
||||||
import config
|
|
||||||
|
import praw
|
||||||
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
# Create default config/config.py if it doesn't exist
|
||||||
|
default_config_path = os.path.join('config', 'config.py')
|
||||||
|
if not os.path.exists(default_config_path):
|
||||||
|
os.makedirs('config', exist_ok=True)
|
||||||
|
with open(default_config_path, 'w') as f:
|
||||||
|
f.write(
|
||||||
|
'username = ""\n'
|
||||||
|
'password = ""\n'
|
||||||
|
'client_id = ""\n'
|
||||||
|
'client_secret = ""\n'
|
||||||
|
'user_agent = "Flair Timer Comment Bot"\n'
|
||||||
|
'\n'
|
||||||
|
'# Subreddits\n'
|
||||||
|
'subreddit = ""\n'
|
||||||
|
'flair_text = "Waiting for OP"\n'
|
||||||
|
'interval = 30\n'
|
||||||
|
'hours = 48\n'
|
||||||
|
'searchlimit = 600\n'
|
||||||
|
'comment_message = ""\n'
|
||||||
|
'lock_post = False\n'
|
||||||
|
'distinguish_sticky = False\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
import config
|
||||||
def authentication():
|
def authentication():
|
||||||
print ("Authenticating...")
|
print ("Authenticating...")
|
||||||
reddit = praw.Reddit(username = config.username,
|
reddit = praw.Reddit(username = config.username,
|
||||||
|
|||||||
Reference in New Issue
Block a user