diff --git a/bot.py b/bot.py index 18ecc57..a56856e 100755 --- a/bot.py +++ b/bot.py @@ -32,7 +32,7 @@ try: print 'ERROR: more than one connection named "%s"' % name raise ValueError bot.conns[name] = irc(conf['server'], conf['nick'], - channels=conf['channels'], conf=conf) + port=conf.get('port', 6667), channels=conf['channels'], conf=conf) except Exception, e: print 'ERROR: malformed config file', Exception, e sys.exit() diff --git a/core/config.py b/core/config.py index 0fc8dee..12336bc 100644 --- a/core/config.py +++ b/core/config.py @@ -4,9 +4,19 @@ from util import yaml if not os.path.exists('config'): conf = {'connections': [ - {'local irc': {'nick': 'skybot', - 'server': 'localhost', - 'channels': ["#test"]}}]} + {'local irc': + {'nick': 'skybot', + #'user': 'skybot', + #'realname': 'Python bot - http://bitbucket.org/Scaevolus/skybot/', + 'server': 'localhost', + #'port': 6667, + 'channels': ["#test"], + #'nickserv_password', 'password', + #'nickserv_name': 'nickserv', + #'nickserv_command': 'IDENTIFY %s' + } + } + ]} yaml.dump(conf, open('config', 'w')) del conf diff --git a/core/irc.py b/core/irc.py index b86ff60..c8c050c 100644 --- a/core/irc.py +++ b/core/irc.py @@ -93,8 +93,9 @@ class irc(object): self.conn = crlf_tcp(self.server, self.port) thread.start_new_thread(self.conn.run, ()) self.set_nick(self.nick) - self.cmd("USER", ["skybot", "3", "*", - ":Python bot - http://bitbucket.org/Scaevolus/skybot/"]) + self.cmd("USER", + [conf.get('user', 'skybot'), "3", "*", ':' + conf.get('realname', + 'Python bot - http://bitbucket.org/Scaevolus/skybot/')]) def parse_loop(self): while True: