summaryrefslogtreecommitdiffstats
path: root/actions/pythondoc.py
diff options
context:
space:
mode:
Diffstat (limited to 'actions/pythondoc.py')
-rw-r--r--actions/pythondoc.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/actions/pythondoc.py b/actions/pythondoc.py
new file mode 100644
index 0000000..e420723
--- /dev/null
+++ b/actions/pythondoc.py
@@ -0,0 +1,22 @@
1import os
2
3class pythondoc:
4
5 def __init__(self):
6 self = []
7
8 def getAction(self, data):
9 try:
10 input = data.split(' ')
11 module = input[5].replace(' ', '')
12 try:
13 module2 = input[6][0:-2]
14 execstring = "python -c \"from " + module + " import " + module2 + "\nprint " + module2 + ".__doc__\n\" > /tmp/wmpycmd"
15 except:
16 module = input[5][0:-2]
17 execstring = "python -c \"import " + module + "\nprint " + module + ".__doc__\n\" > /tmp/wmpycmd"
18 os.system(execstring)
19 doc = file('/tmp/wmpycmd').read().replace("\n", " ")
20 except:
21 doc = "I don't know nuthn about that."
22 return 'PRIVMSG ' + input[2] + ' :' + doc