Network: add @capabilities command.

This commit is contained in:
Valentin Lorentz 2020-11-09 21:45:01 +01:00
parent c062787436
commit 81a7530577

View File

@ -39,7 +39,7 @@ import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.registry as registry import supybot.registry as registry
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.i18n import PluginInternationalization, internationalizeDocstring from supybot.i18n import PluginInternationalization
_ = PluginInternationalization('Network') _ = PluginInternationalization('Network')
class Network(callbacks.Plugin): class Network(callbacks.Plugin):
@ -54,7 +54,6 @@ class Network(callbacks.Plugin):
else: else:
raise callbacks.Error('I\'m not currently connected to %s.' % network) raise callbacks.Error('I\'m not currently connected to %s.' % network)
@internationalizeDocstring
def connect(self, irc, msg, args, opts, network, server, password): def connect(self, irc, msg, args, opts, network, server, password):
"""[--nossl] <network> [<host[:port]>] [<password>] """[--nossl] <network> [<host[:port]>] [<password>]
@ -106,7 +105,6 @@ class Network(callbacks.Plugin):
additional('something'), additional('something'),
additional('something', '')]) additional('something', '')])
@internationalizeDocstring
def disconnect(self, irc, msg, args, otherIrc, quitMsg): def disconnect(self, irc, msg, args, otherIrc, quitMsg):
"""<network> [<quit message>] """<network> [<quit message>]
@ -126,7 +124,6 @@ class Network(callbacks.Plugin):
otherIrc.network) otherIrc.network)
disconnect = wrap(disconnect, ['owner', ('networkIrc', True), additional('text')]) disconnect = wrap(disconnect, ['owner', ('networkIrc', True), additional('text')])
@internationalizeDocstring
def reconnect(self, irc, msg, args, otherIrc, quitMsg): def reconnect(self, irc, msg, args, otherIrc, quitMsg):
"""[<network>] [<quit message>] """[<network>] [<quit message>]
@ -146,7 +143,6 @@ class Network(callbacks.Plugin):
irc.replySuccess() irc.replySuccess()
reconnect = wrap(reconnect, ['owner', 'networkIrc', additional('text')]) reconnect = wrap(reconnect, ['owner', 'networkIrc', additional('text')])
@internationalizeDocstring
def command(self, irc, msg, args, otherIrc, commandAndArgs): def command(self, irc, msg, args, otherIrc, commandAndArgs):
"""<network> <command> [<arg> ...] """<network> <command> [<arg> ...]
@ -217,7 +213,6 @@ class Network(callbacks.Plugin):
do401 = do402 do401 = do402
do406 = do402 do406 = do402
@internationalizeDocstring
def whois(self, irc, msg, args, otherIrc, nick): def whois(self, irc, msg, args, otherIrc, nick):
"""[<network>] <nick> """[<network>] <nick>
@ -231,7 +226,6 @@ class Network(callbacks.Plugin):
self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whois') self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whois')
whois = wrap(whois, ['networkIrc', 'nick']) whois = wrap(whois, ['networkIrc', 'nick'])
@internationalizeDocstring
def whowas(self, irc, msg, args, otherIrc, nick): def whowas(self, irc, msg, args, otherIrc, nick):
"""[<network>] <nick> """[<network>] <nick>
@ -245,7 +239,6 @@ class Network(callbacks.Plugin):
self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whowas') self._whois[(otherIrc, nick)] = (irc, msg, {}, 'whowas')
whowas = wrap(whowas, ['networkIrc', 'nick']) whowas = wrap(whowas, ['networkIrc', 'nick'])
@internationalizeDocstring
def networks(self, irc, msg, args, opts): def networks(self, irc, msg, args, opts):
"""[--all] """[--all]
@ -269,7 +262,6 @@ class Network(callbacks.Plugin):
(replyIrc, when) = self._latency.pop(irc) (replyIrc, when) = self._latency.pop(irc)
replyIrc.reply(_('%.2f seconds.') % (now-when)) replyIrc.reply(_('%.2f seconds.') % (now-when))
@internationalizeDocstring
def latency(self, irc, msg, args, otherIrc): def latency(self, irc, msg, args, otherIrc):
"""[<network>] """[<network>]
@ -283,7 +275,6 @@ class Network(callbacks.Plugin):
irc.noReply() irc.noReply()
latency = wrap(latency, ['networkIrc']) latency = wrap(latency, ['networkIrc'])
@internationalizeDocstring
def driver(self, irc, msg, args, otherIrc): def driver(self, irc, msg, args, otherIrc):
"""[<network>] """[<network>]
@ -294,7 +285,6 @@ class Network(callbacks.Plugin):
irc.reply(otherIrc.driver.__class__.__module__[8:]) irc.reply(otherIrc.driver.__class__.__module__[8:])
driver = wrap(driver, ['networkIrc']) driver = wrap(driver, ['networkIrc'])
@internationalizeDocstring
def uptime(self, irc, msg, args, otherIrc): def uptime(self, irc, msg, args, otherIrc):
"""[<network>] """[<network>]
@ -307,6 +297,15 @@ class Network(callbacks.Plugin):
(network, utils.timeElapsed(now - started))) (network, utils.timeElapsed(now - started)))
uptime = wrap(uptime, ['networkIrc']) uptime = wrap(uptime, ['networkIrc'])
def capabilities(self, irc, msg, args, otherIrc):
"""[<network>]
Returns the list of IRCv3 capabilities available on the network.
"""
irc.reply(format("%L", sorted(otherIrc.state.capabilities_ls)))
capabilities = wrap(capabilities, ['networkIrc'])
Class = Network Class = Network
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: