/
run.py
32 lines (29 loc) · 996 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#######################################
# LinkFixerBotSnr, by /u/WinneonSword #
#######################################
import praw, time, sys, os, json, argparse
# This is the default config template. #
defaultConfig = {
'reddit': {
'username': '',
'password': '',
},
}
# This function writes the config template to config.json.
def writeConfig(conf):
config = json.dumps(conf, indent = 4, sort_keys = True)
with open('config.json', 'w') as f:
f.write(config)
# This is what gets called first. It checks for a config.json, if not, creates one, and then starts the stript at LFB.py. #
if __name__ == "__main__":
if not os.path.isfile('config.json'):
writeConfig(defaultConfig)
print("[ wsLFB ] - Created default configuration. Please edit the values before you start this again.")
elif 'updateconf' in sys.argv:
with open('config.json', 'r') as f:
config = json.loads(f.read())
defaultConfig.update(config)
writeConfig(defaultConfig)
else:
import LFB
LFB.main()