-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsettingMaker.py
34 lines (24 loc) · 1.03 KB
/
settingMaker.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
33
from configparser import ConfigParser
from os.path import exists as file_exists
config = ConfigParser()
def tbaAppend(tbaSecret):
print(tbaSecret)
config.set('main', 'TBA-KEY', tbaSecret)
with open('settings.ini', 'w+') as f:
config.write(f)
return str(config.get('main', 'TBA-KEY'))
# function for the settings creation and checker, called every time the main program is run to make sure a settings file always exists
def configSetup():
config.read('settings.ini')
#check for settings.ini. If it exists, we good. Otherwise, create with these default values.
if file_exists('settings.ini'):
print("settings.ini already exists!")
else:
config.add_section('main')
#Need to make a way to ask the user for key on first time startup
config.set('main', 'TBA-KEY', '')
config.set('main', "rounding",'2')
config.set('main',"stop-time",'35')
with open('settings.ini', 'w') as f:
config.write(f)
print("Settings.ini has been created.")