diff options
author | tv <tv@xso> | 2011-09-06 15:38:10 +0200 |
---|---|---|
committer | tv <tv@xso> | 2011-09-06 15:38:10 +0200 |
commit | c62ed6d11d847bad2d95d4e9db6a4f88012a02aa (patch) | |
tree | 3dca5ed79dea344894bfec18395940e023482ca9 | |
parent | 0fcc4bbc442335af17433c347841ce6cb6234bd1 (diff) |
//Reaktor/IRC: export argument to commands
-rwxr-xr-x | Reaktor/IRC/bot2.py | 13 |
1 files changed, 9 insertions, 4 deletions
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)) |