git.cweiske.de
/
errbot-exec.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a313e29
)
Support errbot 5 and python 3
master
github/master
author
Christian Weiske
<cweiske@cweiske.de>
Sun, 18 Mar 2018 22:09:14 +0000
(23:09 +0100)
committer
Christian Weiske
<cweiske@cweiske.de>
Sun, 18 Mar 2018 22:11:11 +0000
(23:11 +0100)
exec.plug
patch
|
blob
|
history
exec.py
patch
|
blob
|
history
diff --git
a/exec.plug
b/exec.plug
index bde04e8365b19ee8be9636efc42384d169ef0bb3..849ccd985a90fd08162a0a5a90cfb9641d44aed5 100644
(file)
--- a/
exec.plug
+++ b/
exec.plug
@@
-9,6
+9,5
@@
description = Execute a command when the bot is talked to
version = 2+
[Errbot]
version = 2+
[Errbot]
-min = 4.0.0
-max = 4.99.99
-
+min = 5.0.0
+max = 5.99.99
diff --git
a/exec.py
b/exec.py
index 207a4f929086cad397400ae1fdd4cbccecfe86d5..d91fc2bba6acb7903bb99a3e2182f766ea7b291f 100644
(file)
--- a/
exec.py
+++ b/
exec.py
@@
-1,7
+1,6
@@
# -*- coding: utf-8 -*-
import os, re, subprocess
# -*- coding: utf-8 -*-
import os, re, subprocess
-from errbot import BotPlugin, botcmd, re_botcmd
-from errbot.utils import ValidationException
+from errbot import BotPlugin, botcmd, re_botcmd, ValidationException
class Exec(BotPlugin):
"""
class Exec(BotPlugin):
"""
@@
-60,15
+59,15
@@
class Exec(BotPlugin):
"""
try:
output = subprocess.check_output(
"""
try:
output = subprocess.check_output(
- [self.config['command'],
unicode(msg.body), unicode
(msg.frm)],
+ [self.config['command'],
msg.body, str
(msg.frm)],
stderr=subprocess.STDOUT
)
if len(output) > 0:
stderr=subprocess.STDOUT
)
if len(output) > 0:
- return
unicode
(output, 'utf-8')
+ return
str
(output, 'utf-8')
else:
return "OK\n"
except subprocess.CalledProcessError as err:
if len(err.output):
else:
return "OK\n"
except subprocess.CalledProcessError as err:
if len(err.output):
- return
unicode
(err.output, 'utf-8')
+ return
str
(err.output, 'utf-8')
else:
return "Error"
else:
return "Error"