5
""" code related commands """
7
__copyright__ = 'this file is in the public domain'
9
from gozerbot.redispatcher import rebefore, reafter
10
from gozerbot.commands import cmnds
11
from gozerbot.examples import examples
12
from gozerbot.generic import exceptionlist
13
from gozerbot.plugins import plugins
14
from gozerbot.aliases import aliasset
15
from gozerbot.plughelp import plughelp
17
plughelp.add('code', 'the code plugin provides code related commands')
19
def handle_showexceptions(bot, ievent):
20
""" show exception list """
21
ievent.reply(str(exceptionlist))
23
cmnds.add('code-exceptions' , handle_showexceptions, 'OPER')
24
examples.add('code-exceptions', 'show exception list', 'code-exceptions')
25
aliasset('exceptions', 'code-exceptions')
27
def handle_funcnames(bot, ievent):
28
""" show function names of a plugin """
30
plugname = ievent.args[0]
32
ievent.missing('<plugname>')
34
if not plugins.exist(plugname):
35
ievent.reply('no %s plugin exists' % plugname)
38
funcnames = rebefore.getfuncnames(plugname)
39
funcnames += cmnds.getfuncnames(plugname)
40
funcnames += reafter.getfuncnames(plugname)
42
ievent.reply(funcnames, dot=True)
44
ievent.reply("can't find funcnames for %s plugin" % plugname)
46
cmnds.add('code-funcnames', handle_funcnames, 'OPER')
47
examples.add('code-funcnames', 'show function names of a plugin', \
48
'code-funcnames birthday')
49
aliasset('funcnames', 'code-funcnames')