have dr.botzo use django settings
a couple are set as a proof of concept, too lazy to move everything right now
This commit is contained in:
parent
6d85a580f3
commit
4633c936fb
|
@ -17,12 +17,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
|
from ConfigParser import ConfigParser, NoSectionError, NoOptionError
|
||||||
import logging
|
import logging
|
||||||
import logging.config
|
import logging.config
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
# gross hack
|
||||||
|
sys.path.insert(0, 'ircbot')
|
||||||
|
|
||||||
import MySQLdb as mdb
|
import MySQLdb as mdb
|
||||||
|
|
||||||
import DrBotIRC
|
import DrBotIRC
|
||||||
|
@ -36,22 +41,6 @@ if len(sys.argv) == 2:
|
||||||
config = ConfigParser({'debug': 'false'})
|
config = ConfigParser({'debug': 'false'})
|
||||||
config.read(os.path.expanduser(config_file))
|
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')
|
logging.config.fileConfig('logging.cfg')
|
||||||
log = logging.getLogger('drbotzo')
|
log = logging.getLogger('drbotzo')
|
||||||
|
|
||||||
|
@ -111,8 +100,14 @@ else:
|
||||||
|
|
||||||
# create IRC and server objects and connect
|
# create IRC and server objects and connect
|
||||||
irc = DrBotIRC.DrBotIRC(config)
|
irc = DrBotIRC.DrBotIRC(config)
|
||||||
server = irc.server().connect(botserver, botport, botnick, botpass,
|
server = irc.server().connect(settings.IRC_SERVER,
|
||||||
botuser, botircname, ssl=use_ssl, ipv6=use_ipv6)
|
settings.IRC_PORT,
|
||||||
|
settings.IRC_NICK,
|
||||||
|
settings.IRC_PASS,
|
||||||
|
settings.IRC_USER,
|
||||||
|
settings.IRC_NAME,
|
||||||
|
ssl=use_ssl,
|
||||||
|
ipv6=use_ipv6)
|
||||||
|
|
||||||
# load features
|
# load features
|
||||||
try:
|
try:
|
Loading…
Reference in New Issue