add !servers command
This commit is contained in:
parent
4914c47401
commit
efbe71bc0e
1 changed files with 14 additions and 2 deletions
|
@ -147,14 +147,26 @@ class Module(ModuleManager.BaseModule):
|
||||||
channels = []
|
channels = []
|
||||||
for channel in event["server"].channels.values():
|
for channel in event["server"].channels.values():
|
||||||
hidden = bool(HIDDEN_MODES&set(channel.modes.keys()))
|
hidden = bool(HIDDEN_MODES&set(channel.modes.keys()))
|
||||||
if hidden and (
|
if (hidden and
|
||||||
event["is_channel"] and not channel == event["target"]):
|
event["is_channel"] and
|
||||||
|
not channel == event["target"]):
|
||||||
continue
|
continue
|
||||||
channels.append(channel.name)
|
channels.append(channel.name)
|
||||||
|
|
||||||
event["stdout"].write("Current channels: %s" %
|
event["stdout"].write("Current channels: %s" %
|
||||||
" ".join(sorted(channels)))
|
" ".join(sorted(channels)))
|
||||||
|
|
||||||
|
@utils.hook("received.command.servers")
|
||||||
|
@utils.kwarg("help", "List all servers (* = connected)")
|
||||||
|
@utils.kwarg("permission", "listservers")
|
||||||
|
def servers_command(self, event):
|
||||||
|
servers = []
|
||||||
|
for id, alias in self.bot.database.servers.get_all():
|
||||||
|
if not self.bot.get_server_by_id(id) == None:
|
||||||
|
alias = "*%s" % alias
|
||||||
|
servers.append(alias)
|
||||||
|
event["stdout"].write("Servers: %s" % ", ".join(sorted(servers)))
|
||||||
|
|
||||||
@utils.hook("api.get.modules")
|
@utils.hook("api.get.modules")
|
||||||
def modules_api(self, event):
|
def modules_api(self, event):
|
||||||
return list(self.bot.modules.modules.keys())
|
return list(self.bot.modules.modules.keys())
|
||||||
|
|
Loading…
Reference in a new issue