fixed new config engine, moved IRC loading

This commit is contained in:
Luke Rogers 2013-10-01 19:44:32 +13:00
parent 8eff33b1f7
commit 507c59ad15
4 changed files with 43 additions and 43 deletions

View file

@ -17,13 +17,13 @@ def decode(txt):
def censor(text):
text = text.replace('\n', '').replace('\r', '')
replacement = '[censored]'
if 'censored_strings' in bot.config:
if bot.config['censored_strings']:
words = map(re.escape, bot.config['censored_strings'])
regex = re.compile('({})'.format("|".join(words)))
text = regex.sub(replacement, text)
#text = text.replace('\n', '').replace('\r', '')
#replacement = '[censored]'
#if 'censored_strings' in bot.config:
# if bot.config['censored_strings']:
# words = map(re.escape, bot.config['censored_strings'])
# regex = re.compile('({})'.format("|".join(words)))
# text = regex.sub(replacement, text)
return text
@ -153,7 +153,7 @@ class IRC(object):
self.set_pass(self.conf.get('server_password'))
self.set_nick(self.nick)
self.cmd("USER",
[conf.get('user', 'cloudbot'), "3", "*", conf.get('realname',
[self.conf.get('user', 'cloudbot'), "3", "*", self.conf.get('realname',
'CloudBot - http://git.io/cloudbot')])
def parse_loop(self):