3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +01:00

global: reply with a confirmation

We can also use this space to show the number of channels and networks announced to.
This commit is contained in:
James Lu 2018-06-08 18:28:28 -07:00
parent f82ddb5336
commit 180da83b4e

View File

@ -24,8 +24,12 @@ def g(irc, source, args):
template = string.Template(global_conf.get('format', DEFAULT_FORMAT))
exempt_channels = set(global_conf.get('exempt_channels', set()))
netcount = 0
chancount = 0
for netname, ircd in world.networkobjects.items():
if ircd.connected.is_set(): # Only attempt to send to connected networks
netcount += 1
for channel in ircd.pseudoclient.channels:
local_exempt_channels = exempt_channels | set(ircd.serverdata.get('global_exempt_channels', set()))
@ -51,5 +55,8 @@ def g(irc, source, args):
# Disable relaying or other plugins handling the global message.
ircd.msg(channel, template.safe_substitute(subst), loopback=False)
chancount += 1
irc.reply('Done. Sent to %d channels across %d networks.' % (chancount, netcount))
utils.add_cmd(g, "global", featured=True)