]> jfr.im git - erebus.git/blame - modules/stafflist.py
admin_config - add !getconfig, remove some unused functions
[erebus.git] / modules / stafflist.py
CommitLineData
0ce8eacc 1# Erebus IRC bot - Author: Erebus Team
4477123d 2# vim: fileencoding=utf-8
0ce8eacc 3# staff list module
4# This file is released into the public domain; see http://unlicense.org/
5
6# module info
7modinfo = {
8 'author': 'Erebus Team',
9 'license': 'public domain',
10 'compatible': [0], # compatible module API versions
11 'depends': [], # other modules required to work properly?
12 'softdeps': ['help'], # modules which are preferred but not required
13}
14
15# preamble
16import modlib
17lib = modlib.modlib(__name__)
18modstart = lib.modstart
19modstop = lib.modstop
20
21# module code
7c4a7d0a 22def _getnicks(auth):
23 nicks = [x.nick for x in lib.parent.getuserbyauth(auth)]
24 if len(nicks) == 0:
25 return 'not online'
26 else:
27 return ', '.join(nicks)
28
0ce8eacc 29@lib.hook(needchan=False)
30@lib.help(None, 'lists staff')
31@lib.argsEQ(0)
32def stafflist(bot, user, chan, realtarget, *args):
7c4a7d0a 33 c = lib.parent.query("SELECT auth, level FROM users WHERE level > %s", (lib.parent.cfg.get('stafflist', 'minstafflevel', default=lib.KNOWN),))
0ce8eacc 34 if c:
35 staffs = c.fetchall()
36 c.close()
37 if len(staffs) > 0:
38 if user.glevel > lib.KNOWN:
7c4a7d0a 39 response = ["#%s (%s, %s)" % (i['auth'], _getnicks(i['auth']), i['level']) for i in staffs]
0ce8eacc 40 else:
7c4a7d0a 41 response = ["#%s (%s)" % (i['auth'], _getnicks(i['auth'])) for i in staffs]
0ce8eacc 42 user.msg("Staff listing: %s" % (', '.join(response)))
ab32e225 43 else:
44 user.msg("It's anarchy!")