This repository has been archived on 2023-04-13. You can view files and clone it, but cannot push or open issues or pull requests.
2011-11-20 10:23:31 +01:00
|
|
|
import inspect
|
|
|
|
import json
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
def save(conf):
|
|
|
|
json.dump(conf, open('config', 'w'), sort_keys=True, indent=2)
|
|
|
|
|
|
|
|
if not os.path.exists('config'):
|
2013-08-01 09:17:44 +02:00
|
|
|
print "Please rename 'config.default' to 'config' to set up your bot!"
|
|
|
|
print "For help, see http://git.io/cloudbotirc"
|
2012-02-28 08:49:44 +01:00
|
|
|
print "Thank you for using CloudBot!"
|
|
|
|
sys.exit()
|
2011-11-20 10:23:31 +01:00
|
|
|
|
2012-02-29 06:09:40 +01:00
|
|
|
|
2011-11-20 10:23:31 +01:00
|
|
|
def config():
|
|
|
|
# reload config from file if file has changed
|
|
|
|
config_mtime = os.stat('config').st_mtime
|
|
|
|
if bot._config_mtime != config_mtime:
|
|
|
|
try:
|
|
|
|
bot.config = json.load(open('config'))
|
|
|
|
bot._config_mtime = config_mtime
|
|
|
|
except ValueError, e:
|
2012-02-29 09:48:56 +01:00
|
|
|
print 'error: malformed config', e
|
2011-11-20 10:23:31 +01:00
|
|
|
|
|
|
|
|
2013-11-12 07:06:06 +01:00
|
|
|
bot._config_mtime = 0
|