From 5cde47e9c5ef649482b414009a601a8e23ae29b3 Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 28 Aug 2015 13:47:13 +0200 Subject: Reaktor: reload config if name change detected --- reaktor/core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'reaktor/core.py') diff --git a/reaktor/core.py b/reaktor/core.py index 15166d9..327d120 100755 --- a/reaktor/core.py +++ b/reaktor/core.py @@ -58,6 +58,17 @@ class Reaktor(asybot): self.execute_command(command, None, prefix, params) def on_privmsg(self, prefix, command, params, rest): + if not ( self.nickname == self.getconf('name')): + # reload config if the name changed + # TODO: this sucks, use another sidechannel to tell config the new + # nickname + log.debug("nickname differs ('{}' to '{}')".format( + self.nickname, self.getconf('name'))) + + os.environ['IRC_NICKNAME'] = self.nickname + self.getconf = make_getconf(self.config) + log.info('nickname changed to {}'.format(self.getconf('name'))) + for command in self.getconf('commands'): y = match(command['pattern'], rest) if y: -- cgit v1.2.3