diff --git a/fdskun.py b/fdskun.py index 4fd430a..ec4b865 100644 --- a/fdskun.py +++ b/fdskun.py @@ -26,8 +26,10 @@ class MonitorBot(irc.IRCClient): # callbacks for events def signedOn(self): """Called when bot has succesfully signed on to server.""" + print("[signed in]") self.mode(self.nickname, False, 'x') self.mode(self.nickname, True, 'B') + self.msg('NickServ', 'IDENTIFY %s' % self.factory.nickserv_pw) self.join(self.factory.channel) def joined(self, channel): @@ -44,9 +46,10 @@ class MonitorBotFactory(protocol.ClientFactory): A new protocol instance will be created each time we connect to the server. """ - def __init__(self, nickname, channel, fsmon): + def __init__(self, nickname, channel, nickserv_pw, fsmon): self.nickname = nickname self.channel = channel + self.nickserv_pw = nickserv_pw self.fsmon = fsmon def buildProtocol(self, addr): @@ -140,13 +143,14 @@ if __name__ == '__main__': port = int(config.get('irc', 'port')) channel = config.get('irc', 'channel') nickname = config.get('irc', 'nickname') + nickserv_pw = config.get('irc', 'nickserv_pw') realname = config.get('irc', 'realname') path = config.get('fsmonitor', 'path') fsmon = FSMonitor(path, channel) # create factory protocol and application - f = MonitorBotFactory(nickname, channel, fsmon) + f = MonitorBotFactory(nickname, channel, nickserv_pw, fsmon) # connect factory to this host and port reactor.connectTCP(host, port, f) diff --git a/settings.ini.example b/settings.ini.example index bb5e8ee..06cd86e 100644 --- a/settings.ini.example +++ b/settings.ini.example @@ -4,6 +4,7 @@ port = 6667 nickName = FDS-kun realName = bot: provides tracking of an ftp folder channel = #JPT +nickserv_pw = secret [fsmonitor] path=/tmp/foobar/