prefix "hidden" channels in !channels with "*"

This commit is contained in:
jesopo 2019-11-27 13:13:52 +00:00
parent efbe71bc0e
commit e1f527a374

View file

@ -141,17 +141,19 @@ class Module(ModuleManager.BaseModule):
return channels return channels
@utils.hook("received.command.channels") @utils.hook("received.command.channels")
@utils.kwarg("help", "List all the channel I'm in on this network") @utils.kwarg("help",
"List all the channel I'm in on this network (* = hidden)")
@utils.kwarg("permission", "listchannels") @utils.kwarg("permission", "listchannels")
def channels_command(self, event): def channels_command(self, event):
channels = [] channels = []
for channel in event["server"].channels.values(): for channel in event["server"].channels.values():
name = channel.name
hidden = bool(HIDDEN_MODES&set(channel.modes.keys())) hidden = bool(HIDDEN_MODES&set(channel.modes.keys()))
if (hidden and if hidden:
event["is_channel"] and if event["is_channel"] and not channel == event["target"]:
not channel == event["target"]):
continue continue
channels.append(channel.name) name = "*%s" % name
channels.append(name)
event["stdout"].write("Current channels: %s" % event["stdout"].write("Current channels: %s" %
" ".join(sorted(channels))) " ".join(sorted(channels)))