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