summaryrefslogtreecommitdiffstats
path: root/actions/pythondoc.py
blob: e420723742c3b1b9397d7eb62ff5d7e6e29c4ea1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os

class pythondoc:

    def __init__(self):
        self = []

    def getAction(self, data):
        try:
            input   = data.split(' ')
            module  = input[5].replace(' ', '')
            try:
                module2 = input[6][0:-2] 
                execstring = "python -c \"from " + module + " import " + module2 + "\nprint " + module2 + ".__doc__\n\" > /tmp/wmpycmd" 
            except:
                module = input[5][0:-2]
                execstring = "python -c \"import " + module + "\nprint " + module + ".__doc__\n\" > /tmp/wmpycmd" 
            os.system(execstring)
            doc = file('/tmp/wmpycmd').read().replace("\n", " ")
        except:
            doc = "I don't know nuthn about that."
        return 'PRIVMSG ' + input[2] + ' :' + doc