Return relay numbers with channel list

This commit is contained in:
Mark Veidemanis 2022-08-13 13:47:42 +01:00
parent facf58ec2c
commit df6b9e34a3
1 changed files with 4 additions and 2 deletions

View File

@ -391,14 +391,16 @@ class API(object):
if net not in main.network.keys(): if net not in main.network.keys():
return dumps({"success": False, "reason": "no such net."}) return dumps({"success": False, "reason": "no such net."})
relays_inst = main.network[net].relays relays_inst = main.network[net].relays
channels = {} channels = []
for num in relays_inst.keys(): for num in relays_inst.keys():
name = f"{net}{num}" name = f"{net}{num}"
if name in main.IRCPool.keys(): if name in main.IRCPool.keys():
net_chans = main.IRCPool[name].channels net_chans = main.IRCPool[name].channels
channels_annotated = userinfo.getUserNum(net, net_chans) channels_annotated = userinfo.getUserNum(net, net_chans)
for channel in net_chans: for channel in net_chans:
channels[channel] = channels_annotated[channel] channel_inst = {"name": channel, "users": channels_annotated[channel], "num": num}
channels.append(channel_inst)
# channels[channel] = channels_annotated[channel]
return dumps({"channels": channels}) return dumps({"channels": channels})