diff options
author | makefu <github@syntax-fehler.de> | 2015-08-28 13:47:13 +0200 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-08-28 13:47:13 +0200 |
commit | 4b6a54f8bff3015d2f6e9cd0ee7cc2a2f0bc528a (patch) | |
tree | f883a127635dfb435c5b535276809870f6bdfe41 /Reaktor/reaktor/core.py | |
parent | 0d123c383b08596f68a6e5102cbb17a3e1e6dad5 (diff) |
Reaktor: reload config if name change detected
Diffstat (limited to 'Reaktor/reaktor/core.py')
-rwxr-xr-x | Reaktor/reaktor/core.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Reaktor/reaktor/core.py b/Reaktor/reaktor/core.py index 15166d9e..327d120a 100755 --- a/Reaktor/reaktor/core.py +++ b/Reaktor/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: |