From 6c7f4006b115b791dabf23a41ad11ccc16d4d474 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Mon, 1 Jun 2015 18:25:01 +0200 Subject: [PATCH] [FEATURE] Add nickserv support, add bot mode. --- fdskun.py | 9 +++++++-- settings.ini.example | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/fdskun.py b/fdskun.py index 2c7abbd..9036d4a 100644 --- a/fdskun.py +++ b/fdskun.py @@ -26,6 +26,9 @@ class MonitorBot(irc.IRCClient): # callbacks for events def signedOn(self): """Called when bot has succesfully signed on to server.""" + print("[signed in]") + self.msg('NickServ', 'IDENTIFY %s' % self.factory.nickserv_pw) + self.mode(self.nickname, True, 'B') self.join(self.factory.channel) def joined(self, channel): @@ -42,9 +45,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): @@ -138,13 +142,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/