Implement API endpoint for network listing

This commit is contained in:
2022-07-25 18:05:53 +01:00
parent 24a2f79e8e
commit c302cd25da
3 changed files with 42 additions and 1 deletions

View File

@@ -1,8 +1,8 @@
import main
from core.logstash import sendLogstashNotification
from core.relay import sendRelayNotification
from modules import userinfo
from utils.dedup import dedup
import main
order = [
"type",

View File

@@ -38,6 +38,14 @@ def getChanList(name, nick):
return (i.decode() for i in result)
def getTotalChanNum(net):
"""
Get the number of channels a network has.
"""
chans = main.r.keys(f"live.who.{net}.*")
return len(chans)
def getUserNum(name, channels):
"""
Get the number of users on a list of channels.