From fd97f78f9372fcb23832f8bd0f03b4eb697fb82a Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 25 May 2021 00:13:00 +0200 Subject: [PATCH] Admin: Fix @acmd --- plugins/Admin/plugin.py | 4 ++-- plugins/Admin/test.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/Admin/plugin.py b/plugins/Admin/plugin.py index 386b814f6..f52430c0d 100644 --- a/plugins/Admin/plugin.py +++ b/plugins/Admin/plugin.py @@ -355,8 +355,8 @@ class Admin(callbacks.Plugin): Perform (with associated s on all channels on current network.""" for channel in irc.state.channels: - msg.args[0] = channel - self.Proxy(irc, msg, commandAndArgs) + msg = ircmsgs.IrcMsg(msg=msg, args=(channel, *msg.args[1:])) + self.Proxy(irc.getRealIrc(), msg, commandAndArgs) acmd = wrap(acmd, ['admin', many('something')]) diff --git a/plugins/Admin/test.py b/plugins/Admin/test.py index 9c4cea520..90b8ccc7e 100644 --- a/plugins/Admin/test.py +++ b/plugins/Admin/test.py @@ -30,7 +30,7 @@ from supybot.test import * class AdminTestCase(PluginTestCase): - plugins = ('Admin',) + plugins = ('Admin', 'Utilities') def testChannels(self): def getAfterJoinMessages(): m = self.irc.takeMsg() @@ -121,5 +121,19 @@ class AdminTestCase(PluginTestCase): finally: world.testing = True + def testAcmd(self): + self.irc.feedMsg(ircmsgs.join('#foo', prefix=self.prefix)) + self.irc.feedMsg(ircmsgs.join('#bar', prefix=self.prefix)) + while self.irc.takeMsg(): + pass + msgs = [] + msg = self.getMsg('acmd echo hi $channel') + while msg: + msgs.append(msg) + msg = self.irc.takeMsg() + self.assertCountEqual( + [(msg.command, *msg.args) for msg in msgs], + [("PRIVMSG", "#foo", "hi #foo"), ("PRIVMSG", "#bar", "hi #bar")]) + # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: