aboutsummaryrefslogtreecommitdiffstats
path: root/IRC
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-06 15:38:10 +0200
committertv <tv@xso>2011-09-06 15:38:10 +0200
commitb08022c1421db6de6a3680c37bac03f142f5396d (patch)
treefe565e569c99567e96fc80752bc0023f7823bc06 /IRC
parent97483798513780ffe12ad8484ae05621acded5e1 (diff)
//Reaktor/IRC: export argument to commands
Diffstat (limited to 'IRC')
-rwxr-xr-xIRC/bot2.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/IRC/bot2.py b/IRC/bot2.py
index 170a878..092d34b 100755
--- a/IRC/bot2.py
+++ b/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))