Autocomplete: Fix name of response tag.

This commit is contained in:
Valentin Lorentz 2020-08-29 16:42:19 +02:00
parent a55fbab591
commit fbf9f0166d
2 changed files with 6 additions and 5 deletions

View File

@ -42,11 +42,11 @@ except ImportError:
REQUEST_TAG = "+draft/autocomplete-request" REQUEST_TAG = "+draft/autocomplete-request"
RESPONSE_TAG = "+draft/autocomplete" RESPONSE_TAG = "+draft/autocomplete-response"
def _getAutocompleteResponse(irc, msg, payload): def _getAutocompleteResponse(irc, msg, payload):
"""Returns the value of the +draft/autocomplete tag for the given """Returns the value of the +draft/autocomplete-response tag for the given
+draft/autocomplete-request payload.""" +draft/autocomplete-request payload."""
tokens = callbacks.tokenize(payload, channel=msg.channel, network=irc.network) tokens = callbacks.tokenize(payload, channel=msg.channel, network=irc.network)
normalized_payload = " ".join(tokens) normalized_payload = " ".join(tokens)
@ -130,7 +130,7 @@ class Autocomplete(callbacks.Plugin):
ircmsgs.IrcMsg( ircmsgs.IrcMsg(
server_tags={ server_tags={
"+draft/reply": msgid, "+draft/reply": msgid,
"+draft/autocomplete": autocomplete_response, RESPONSE_TAG: autocomplete_response,
}, },
command="TAGMSG", command="TAGMSG",
args=[target], args=[target],

View File

@ -55,7 +55,7 @@ class AutocompleteTestCase(PluginTestCase):
ircmsgs.IrcMsg( ircmsgs.IrcMsg(
server_tags={ server_tags={
"+draft/reply": "1234", "+draft/reply": "1234",
"+draft/autocomplete": expectedResponse, "+draft/autocomplete-response": expectedResponse,
}, },
command="TAGMSG", command="TAGMSG",
args=["foo"], args=["foo"],
@ -103,12 +103,13 @@ class AutocompleteChannelTestCase(ChannelPluginTestCase):
ircmsgs.IrcMsg( ircmsgs.IrcMsg(
server_tags={ server_tags={
"+draft/reply": "1234", "+draft/reply": "1234",
"+draft/autocomplete": expectedResponse, "+draft/autocomplete-response": expectedResponse,
}, },
command="TAGMSG", command="TAGMSG",
args=[self.channel], args=[self.channel],
), ),
) )
def testResponse(self): def testResponse(self):
with conf.supybot.protocols.irc.experimentalExtensions.context(True): with conf.supybot.protocols.irc.experimentalExtensions.context(True):
with conf.supybot.plugins.Autocomplete.enabled.context(True): with conf.supybot.plugins.Autocomplete.enabled.context(True):