5
""" code related commands. """
7
__copyright__ = 'this file is in the public domain'
10
from gozerbot.redispatcher import rebefore, reafter
11
from gozerbot.commands import cmnds
12
from gozerbot.examples import examples
13
from gozerbot.utils.exception import exceptionlist
14
from gozerbot.plugins import plugins
15
from gozerbot.aliases import aliasset
16
from gozerbot.plughelp import plughelp
17
from gozerbot.tests import tests
19
plughelp.add('code', 'the code plugin provides code related commands')
21
def handle_showexceptions(bot, ievent):
23
""" show exception list. """
26
printto = ievent.args[0]
28
printto = ievent.channel
29
cp = list(exceptionlist)
31
bot.say(printto, exception, groupchat=False)
33
ievent.reply('no exceptions yet !')
35
cmnds.add('code-exceptions' , handle_showexceptions, 'OPER')
36
examples.add('code-exceptions', 'show exception list', '1) code-exceptions 2) code-exceptions bthate@gmail.com')
37
aliasset('exceptions', 'code-exceptions')
38
tests.add('code-exceptions')
40
def handle_funcnames(bot, ievent):
42
""" show function names of a plugin. """
45
plugname = ievent.args[0]
47
ievent.missing('<plugname>')
50
if not plugins.exist(plugname):
51
ievent.reply('no %s plugin exists' % plugname)
55
funcnames = rebefore.getfuncnames(plugname)
56
funcnames += cmnds.getfuncnames(plugname)
57
funcnames += reafter.getfuncnames(plugname)
60
ievent.reply(funcnames, dot=True)
62
ievent.reply("can't find funcnames for %s plugin" % plugname)
64
cmnds.add('code-funcnames', handle_funcnames, 'OPER')
65
examples.add('code-funcnames', 'show function names of a plugin', 'code-funcnames birthday')
66
aliasset('funcnames', 'code-funcnames')
67
tests.add('code-funcnames core', 'handle_version')