create default config if it doesn't exist

This commit is contained in:
2026-02-25 19:53:47 +00:00
parent be5abb7b8b
commit 87d67b98a8

View File

@@ -1,9 +1,35 @@
import praw
import config
import praw
import os
import os.path
import json
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():
print ("Authenticating...")
reddit = praw.Reddit(username = config.username,