mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Network: add 'networks --all' option
This commit is contained in:
parent
88f6496ac2
commit
0c081b8a3b
@ -332,15 +332,22 @@ class Network(callbacks.Plugin):
|
|||||||
whowas = wrap(whowas, ['networkIrc', 'nick'])
|
whowas = wrap(whowas, ['networkIrc', 'nick'])
|
||||||
|
|
||||||
@internationalizeDocstring
|
@internationalizeDocstring
|
||||||
def networks(self, irc, msg, args):
|
def networks(self, irc, msg, args, opts):
|
||||||
"""takes no arguments
|
"""[--all]
|
||||||
|
|
||||||
Returns the networks to which the bot is currently connected.
|
Returns the networks to which the bot is currently connected.
|
||||||
|
If --all is given, also includes networks known by the bot,
|
||||||
|
but not connected to.
|
||||||
"""
|
"""
|
||||||
|
opts = dict(opts)
|
||||||
L = ['%s: %s' % (ircd.network, ircd.server) for ircd in world.ircs]
|
L = ['%s: %s' % (ircd.network, ircd.server) for ircd in world.ircs]
|
||||||
|
if 'all' in opts:
|
||||||
|
for net in conf.supybot.networks._children.keys():
|
||||||
|
if net not in [ircd.network for ircd in world.ircs]:
|
||||||
|
L.append('%s: (%s)' % (net, _('disconnected')))
|
||||||
utils.sortBy(str.lower, L)
|
utils.sortBy(str.lower, L)
|
||||||
irc.reply(format('%L', L))
|
irc.reply(format('%L', L))
|
||||||
networks = wrap(networks)
|
networks = wrap(networks, [getopts({'all': ''})])
|
||||||
|
|
||||||
def doPong(self, irc, msg):
|
def doPong(self, irc, msg):
|
||||||
now = time.time()
|
now = time.time()
|
||||||
|
Loading…
Reference in New Issue
Block a user