strip the connection name

This commit is contained in:
Luke Rogers 2013-08-01 02:33:27 +12:00
parent 7ad1ad20b2
commit 0ee036df56

7
bot.py
View file

@ -15,9 +15,9 @@ import Queue
import sys
import time
import platform
import re
sys.path += ['plugins'] # so 'import hook' works without duplication
sys.path += ['lib']
sys.path += ['plugins', 'lib'] # so 'import hook' works without duplication
os.chdir(sys.path[0] or '.') # do stuff relative to the install directory
@ -56,6 +56,9 @@ bot.conns = {}
try:
for name, conf in bot.config['connections'].iteritems():
# strip all spaces and capitalization from the connection name
name = name.replace(" ", "_")
name = re.sub('[^A-Za-z0-9_]+', '', name).lower()
print 'Connecting to server: %s' % conf['server']
if conf.get('ssl'):
bot.conns[name] = SSLIRC(name, conf['server'], conf['nick'], conf=conf,