From 208d6f21fb1da65aa6ac2598ba555d4ef80627ca Mon Sep 17 00:00:00 2001 From: lassulus Date: Sun, 16 Sep 2018 18:19:37 +0200 Subject: add nickserv password identification --- reaktor/ircasy.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'reaktor/ircasy.py') diff --git a/reaktor/ircasy.py b/reaktor/ircasy.py index f8f85d6..0a4d4eb 100644 --- a/reaktor/ircasy.py +++ b/reaktor/ircasy.py @@ -20,7 +20,7 @@ class asybot(asychat): def __init__( self, server, port, nickname, channels, realname=False, username=False, hostname=False, hammer_interval=10, alarm_timeout=300, - kill_timeout=360, loglevel=logging.ERROR + kill_timeout=360, loglevel=logging.ERROR, nickserv_password=None ): asychat.__init__(self) # logger magic @@ -52,6 +52,7 @@ class asybot(asychat): self.create_socket(AF_INET, SOCK_STREAM) self.connect((self.server, self.port)) self.wrapper = TextWrapper(subsequent_indent=" ", width=400) + self.nickserv_password = nickserv_password self.log.info('=> irc://%s@%s:%s/%s' % (self.nickname, self.server, self.port, self.channels)) @@ -132,6 +133,9 @@ class asybot(asychat): elif command == '376' or '422': self.on_welcome(prefix, command, params, rest) + elif command == 'NOTICE' and rest.startswith('You are now identified'): + self.push('JOIN %s' % ','.join(self.channels)) + self.reset_alarm() def push(self, message): @@ -177,6 +181,8 @@ class asybot(asychat): self.PRIVMSG(target, ('ACTION ' + text + '')) def on_welcome(self, prefix, command, params, rest): + if self.nickserv_password: + self.push(f'PRIVMSG nickserv :IDENTIFY {self.nickserv_password}') self.push('JOIN %s' % ','.join(self.channels)) def on_kick(self, prefix, command, params, rest): -- cgit v1.2.3