diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index ecbd50c0a..f9e770a75 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -467,6 +467,7 @@ class Aka(callbacks.Plugin): replace(tokens, lambda s: dollarRe.sub(regexpReplace, s)) if biggestAt: assert not wildcard + args = args[biggestDollar:] replace(tokens, lambda s: atRe.sub(regexpReplace, s)) if wildcard: assert not biggestAt diff --git a/plugins/Aka/test.py b/plugins/Aka/test.py index acf7974e8..50ed3e79f 100644 --- a/plugins/Aka/test.py +++ b/plugins/Aka/test.py @@ -135,6 +135,11 @@ class AkaChannelTestCase(ChannelPluginTestCase): self.assertResponse('myrepr foo', '"foo"') self.assertResponse('myrepr ""', '""') + def testRequiredAndOptional(self): + self.assertNotError('aka add reqopt "echo req=$1, opt=@1"') + self.assertResponse('reqopt foo bar', 'req=foo, opt=bar') + self.assertResponse('reqopt foo', 'req=foo, opt=') + def testNoExtraSpaces(self): self.assertNotError('aka add foo "action takes $1\'s money"') self.assertResponse('foo bar', '\x01ACTION takes bar\'s money\x01')