Added the "action" command and associated tests.

This commit is contained in:
Daniel DiPaolo 2003-10-30 17:16:02 +00:00
parent 9ddc7c75f5
commit c318d5e384
2 changed files with 12 additions and 0 deletions

View File

@ -38,6 +38,8 @@ import plugins
import string
import utils
import ircmsgs
import ircutils
import privmsgs
import callbacks
@ -142,6 +144,13 @@ class Utilities(callbacks.Privmsg):
"""
irc.reply(msg, ' '.join(args), prefixName=False)
def action(self, irc, msg, args):
"""takes any number of arguments
Returns the arguments given it, but as an action.
"""
irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), ' '.join(args)))
def re(self, irc, msg, args):
"""<regexp> <text>

View File

@ -65,6 +65,9 @@ class UtilitiesTestCase(PluginTestCase, PluginDocumentation):
m = self.getMsg('cpustats')
self.assertResponse('echo "%s"' % m.args[1], m.args[1])
def testAction(self):
self.assertAction('action moos', 'moos')
def testRe(self):
self.assertResponse('re "m/My children/" [cpustats]', 'My children')
self.assertResponse('re s/user/luser/g user user', 'luser luser')