From c62ed6d11d847bad2d95d4e9db6a4f88012a02aa Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 6 Sep 2011 15:38:10 +0200 Subject: //Reaktor/IRC: export argument to commands --- Reaktor/IRC/bot2.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Reaktor') diff --git a/Reaktor/IRC/bot2.py b/Reaktor/IRC/bot2.py index 170a878f..092d34bb 100755 --- a/Reaktor/IRC/bot2.py +++ b/Reaktor/IRC/bot2.py @@ -48,10 +48,15 @@ class IRCBot(SimpleIRCClient): command = join(public_commands, _command) if is_executable(command): + + env = {} + if _argument != None: + env['argument'] = _argument + try: - p = popen([command], stdin=PIPE, stdout=PIPE, stderr=PIPE) + p = popen([command], stdin=PIPE, stdout=PIPE, stderr=PIPE, env=env) except OSError, error: - ME(self.target, 'I am made of stupid') + ME(self.target, 'is made of stupid') print('OSError@%s: %s' % (argv, error)) return @@ -65,13 +70,13 @@ class IRCBot(SimpleIRCClient): [print('%s stderr: %s' % (pid, x)) for x in stderr] if code == 0: - [PRIVMSG(self.target, _from + ': ' + x) for x in stdout] + [PRIVMSG(self.target, x) for x in stdout] [PRIVMSG(_source, x) for x in stderr] else: ME(self.target, 'mimimi') else: - ME(self.target, 'believes that ' + _from + ' is made of stupid') + PRIVMSG(self.target, _from + ': you are made of stupid') def on_welcome(self, connection, event): print('I\'m welcome! :D joining to %s now...' % (self.target)) -- cgit v1.2.3