mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 18:54:05 +01:00
commands: refactor showchan to use IrcChannel.getPrefixModes()
This commit is contained in:
parent
04e37ebd04
commit
62f78a60a9
@ -86,7 +86,6 @@ def showchan(irc, source, args):
|
|||||||
return
|
return
|
||||||
|
|
||||||
nicks = [irc.users[u].nick for u in c.users]
|
nicks = [irc.users[u].nick for u in c.users]
|
||||||
pmodes = ('owner', 'admin', 'op', 'halfop', 'voice')
|
|
||||||
|
|
||||||
f('Information on channel \x02%s\x02:' % channel)
|
f('Information on channel \x02%s\x02:' % channel)
|
||||||
f('\x02Channel topic\x02: %s' % c.topic)
|
f('\x02Channel topic\x02: %s' % c.topic)
|
||||||
@ -99,9 +98,10 @@ def showchan(irc, source, args):
|
|||||||
# Iterate over the user list, sorted by nick.
|
# Iterate over the user list, sorted by nick.
|
||||||
for user, nick in sorted(zip(c.users, nicks),
|
for user, nick in sorted(zip(c.users, nicks),
|
||||||
key=lambda userpair: userpair[1].lower()):
|
key=lambda userpair: userpair[1].lower()):
|
||||||
prefixmodes = [irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '')
|
for pmode in c.getPrefixModes(user):
|
||||||
for pmode in pmodes if user in c.prefixmodes[pmode]]
|
# Show prefix modes in order from highest to lowest.
|
||||||
nicklist.append(''.join(prefixmodes) + nick)
|
nick = irc.prefixmodes.get(irc.cmodes.get(pmode, ''), '') + nick
|
||||||
|
nicklist.append(nick)
|
||||||
|
|
||||||
while nicklist[:20]: # 20 nicks per line to prevent message cutoff.
|
while nicklist[:20]: # 20 nicks per line to prevent message cutoff.
|
||||||
f('\x02User list\x02: %s' % ' '.join(nicklist[:20]))
|
f('\x02User list\x02: %s' % ' '.join(nicklist[:20]))
|
||||||
|
Loading…
Reference in New Issue
Block a user