]>
Commit | Line | Data |
---|---|---|
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 | |
7 | modinfo = { | |
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 | |
16 | import modlib | |
17 | lib = modlib.modlib(__name__) | |
18 | modstart = lib.modstart | |
19 | modstop = lib.modstop | |
20 | ||
21 | # module code | |
7c4a7d0a | 22 | def _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) | |
32 | def 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))) |