Admin: Fix @acmd

This commit is contained in:
Valentin Lorentz 2021-05-25 00:13:00 +02:00
parent 1455a83391
commit fd97f78f93
2 changed files with 17 additions and 3 deletions

View File

@ -355,8 +355,8 @@ class Admin(callbacks.Plugin):
Perform <command> (with associated <arg>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')])

View File

@ -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: