diff --git a/ircbot/dr.botzo.py b/dr.botzo.py similarity index 80% rename from ircbot/dr.botzo.py rename to dr.botzo.py index c59c383..ca434ee 100644 --- a/ircbot/dr.botzo.py +++ b/dr.botzo.py @@ -17,12 +17,17 @@ along with this program. If not, see . """ +from django.conf import settings + from ConfigParser import ConfigParser, NoSectionError, NoOptionError import logging import logging.config import os import sys +# gross hack +sys.path.insert(0, 'ircbot') + import MySQLdb as mdb import DrBotIRC @@ -36,22 +41,6 @@ if len(sys.argv) == 2: config = ConfigParser({'debug': 'false'}) config.read(os.path.expanduser(config_file)) -# load necessary options -try: - # load connection info - botserver = config.get('dr.botzo', 'server') - botport = config.getint('dr.botzo', 'port') - botnick = config.get('dr.botzo', 'nick') - botpass = config.get('dr.botzo', 'pass') - botuser = config.get('dr.botzo', 'user') - botircname = config.get('dr.botzo', 'name') -except NoSectionError as e: - sys.exit("Aborted due to error with necessary configuration: " - "{0:s}".format(str(e))) -except NoOptionError as e: - sys.exit("Aborted due to error with necessary configuration: " - "{0:s}".format(str(e))) - logging.config.fileConfig('logging.cfg') log = logging.getLogger('drbotzo') @@ -111,8 +100,14 @@ else: # create IRC and server objects and connect irc = DrBotIRC.DrBotIRC(config) -server = irc.server().connect(botserver, botport, botnick, botpass, - botuser, botircname, ssl=use_ssl, ipv6=use_ipv6) +server = irc.server().connect(settings.IRC_SERVER, + settings.IRC_PORT, + settings.IRC_NICK, + settings.IRC_PASS, + settings.IRC_USER, + settings.IRC_NAME, + ssl=use_ssl, + ipv6=use_ipv6) # load features try: diff --git a/ircbot/logging.cfg b/logging.cfg similarity index 100% rename from ircbot/logging.cfg rename to logging.cfg