]>
jfr.im git - z_archive/Ophion.git/blob - modules/autoload/help.py
6 cache
.currmod
= __name__
7 cache
.hookcmd('HELP', 0, dohelp
, 0, helphelp
, isadmin
=True)
8 cache
.hookcmd('SHOWCOMMANDS', 0, showcommands
, 0, helpshowcommands
, isadmin
=True)
9 def deinit(cache
, reloading
=False):
10 cache
.currmod
= __name__
11 cache
.unhookcmd('HELP')
12 cache
.unhookcmd('SHOWCOMMANDS')
14 def dohelp(nick
, target
, params
, bot
, cache
):
15 if len(params
) == 0: showcommands(nick
, target
, params
, bot
, cache
)
17 thehelp
= cache
.gethelp(params
.upper(), nick
)
18 if thehelp
is not None:
19 bot
.msg(nick
, '-- HELP for %s' % (params
))
20 bot
.msg(nick
, 'Syntax: %s' % (thehelp
[0]))
21 for theline
in thehelp
[1:]:
22 bot
.msg(nick
, theline
)
23 bot
.msg(nick
, '-- End of HELP for %s' % (params
))
25 bot
.msg(nick
, "HELP for %s not available: no such command or not enough access." % (params
))
27 def showcommands(nick
, target
, params
, bot
, cache
):
29 if nick
in cache
.users
:
30 access
= cache
.users
[nick
].access
33 bot
.msg(nick
, '-- COMMAND LIST')
34 for key
in sorted(cache
.cmds
):
36 if access
>= cmd
['level']:
37 cmdhelp
= cmd
['helpfunc']()
38 if len(cmdhelp
) == 3 and access
>= 1:
39 bot
.msg(nick
, "%-20s %s [module: %s]" % (cmdhelp
[0], cmdhelp
[1], cmdhelp
[2]))
41 bot
.msg(nick
, "%-20s %s" % (cmdhelp
[0], cmdhelp
[1]))
42 bot
.msg(nick
, '-- End of COMMAND LIST')
44 def helphelp(): return ['HELP [<command>]', 'Requests help for a command, or shows a command list.']
45 def helpshowcommands(): return ['SHOWCOMMANDS', 'Shows a command list.']