From b341320e37a08764ab56a82f13ef1e87cb6040df Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 4 Oct 2018 17:18:40 +0100 Subject: [PATCH] Add api.servers endpoint --- modules/stats.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/stats.py b/modules/stats.py index bb44cf14..05a71ff8 100644 --- a/modules/stats.py +++ b/modules/stats.py @@ -48,6 +48,18 @@ class Module(ModuleManager.BaseModule): networks, channels, users = self._stats() return {"networks": networks, "channels": channels, "users": users} + @utils.hook("api.servers") + def servers_api(self, event): + servers = {} + for server in self.bot.servers.values(): + servers[server.id] = { + "hostname": server.target_hostname, + "port": server.port, + "tls": server.tls, + "alias": server.alias + } + return servers + @utils.hook("api.channels") def channels_api(self, event): print(event["path"])