more options loading, debug mode

This commit is contained in:
Brian S. Stephan 2010-07-24 11:34:19 -05:00
parent 59d44640d7
commit e4e2014086
2 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,7 @@
[IRC] [IRC]
server = irc.foonetic.net server = irc.foonetic.net
port = 6667 port = 6667
channel = #lh channel = #bss
nick = dr_devzo nick = dr_devzo
name = dr. devzo name = dr. devzo
debug = true

View File

@ -23,9 +23,10 @@ def on_connect(connection, event):
# read config file # read config file
config = ConfigParser() config = ConfigParser({'debug': 'false'})
config.read([os.path.expanduser('~/.dr.botzo.cfg'), 'dr.botzo.cfg']) config.read([os.path.expanduser('~/.dr.botzo.cfg'), 'dr.botzo.cfg'])
# load necessary options
try: try:
# load connection info # load connection info
server = config.get('IRC', 'server') server = config.get('IRC', 'server')
@ -38,6 +39,9 @@ except NoSectionError as e:
except NoOptionError as e: except NoOptionError as e:
sys.exit("Aborted due to error with necessary configuration: " + str(e)) sys.exit("Aborted due to error with necessary configuration: " + str(e))
# load additional options
irclib.DEBUG = config.getboolean('IRC', 'debug')
# start up the IRC bot # start up the IRC bot
# create IRC and server objects and connect # create IRC and server objects and connect