diff options
author | Chris Oliver <excid3@gmail.com> | 2010-02-08 23:04:00 -0600 |
---|---|---|
committer | Chris Oliver <excid3@gmail.com> | 2010-02-08 23:04:00 -0600 |
commit | df6c918e403d09c51f0a8426260f2c5c2af5bc23 (patch) | |
tree | fd007b65d78fdf6776c4519cde8ef176dd7fbe73 | |
parent | 050a1530c342f3ac5bfcd0ec8b37ab37626ad75d (diff) | |
download | logbot-df6c918e403d09c51f0a8426260f2c5c2af5bc23.tar.xz |
Added auto-identify
-rw-r--r-- | conf/example.conf | 3 | ||||
-rw-r--r-- | logbot.py | 13 |
2 files changed, 13 insertions, 3 deletions
diff --git a/conf/example.conf b/conf/example.conf index c5a1cdc..cc2a4e2 100644 --- a/conf/example.conf +++ b/conf/example.conf @@ -3,8 +3,9 @@ network = irc.freenode.net port = 6667 channels = #keryx nick = Timber +password = owners = excid3 [log] folder = logs -stylesheet = file:///C:\Users\Chris Oliver\Desktop\logbot\conf\stylesheet.css
\ No newline at end of file +stylesheet = file:///C:\Users\Chris Oliver\Desktop\logbot\conf\stylesheet.css @@ -56,12 +56,13 @@ html_header = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" class LogBot(object): - def __init__(self, network, port, channels, owner, nick, folder, stylesheet): + def __init__(self, network, port, channels, owner, nick, password, folder, stylesheet): self.network = network self.port = port self.channels = channels self.owner = owner self.nick = nick + self.password = password self.folder = folder self.stylesheet = stylesheet @@ -90,6 +91,10 @@ class LogBot(object): # Create a server object, connect and join the channel self.server = self.irc.server() self.server.connect(self.network, self.port, self.nick, ircname=self.nick) + + if self.password: + self.server.privmsg("nickserv", "identify %s" % self.password) + for channel in self.channels: self.server.join(channel) @@ -241,11 +246,15 @@ def main(conf): port = CONFIG.getint('irc', 'port') channels = CONFIG.get('irc', 'channels').split(',') nick = CONFIG.get('irc', 'nick') + try: + password = CONFIG.get('irc', 'password') + except: + password = None owner = CONFIG.get('irc', 'owners').split(',') logs_folder = CONFIG.get('log', 'folder') stylesheet = CONFIG.get('log', 'stylesheet') - bot = LogBot(network, port, channels, owner, nick, logs_folder, stylesheet) + bot = LogBot(network, port, channels, owner, nick, password, logs_folder, stylesheet) try: bot.start() except KeyboardInterrupt: |