-
Notifications
You must be signed in to change notification settings - Fork 42
/
loadconfig.py
54 lines (50 loc) · 1.8 KB
/
loadconfig.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
configFile = os.path.join('.', 'config', 'config.py')
if os.path.isfile(configFile):
try:
from config.config import __token__
except ImportError:
raise Exception('__token__ variable MUST be set ')
try:
from config.config import __prefix__
except ImportError:
__prefix__ = ':'
try:
from config.config import __botserverid__
except ImportError:
__botserverid__ = 0
try:
from config.config import __greetmsg__
except ImportError:
__greetmsg__ = ''
try:
from config.config import __leavemsg__
except ImportError:
__leavemsg__ = ''
try:
from config.config import __kawaiichannel__
except ImportError:
__kawaiichannel__ = 0
try:
from config.config import __timezone__
except ImportError:
__timezone__ = 0
try:
from config.config import __selfassignrole__
except ImportError:
__selfassignrole__ = 'NSFW'
else:
#Fallback for Heroku or Docker environments
__token__ = os.environ.get('DISCORD_TOKEN')
if __token__ == '':
raise Exception('DISCORD_TOKEN environment variable MUST be set ')
__prefix__ = os.environ.get('DISCORD_PREFIX', ':')
__botserverid__ = int(os.environ.get('DISCORD_BOTSERVERID', 0))
__kawaiichannel__ = int(os.environ.get('DISCORD_KAWAIICHANNEL', 0))
__greetmsg__ = os.environ.get('DISCORD_GREETMSG', '')
__leavemsg__ = os.environ.get('DISCORD_LEAVEMSG', '')
__timezone__ = os.environ.get('DISCORD_TIMEZONE', 'Europe/London')
__selfassignrole__ = os.environ.get('DISCORD_SELFASSIGNROLE', 'NSFW')
from config.games import __games__, __gamesTimer__
from config.cogs import __cogs__
from config.blacklist import __blacklist__