mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Added the "action" command and associated tests.
This commit is contained in:
parent
9ddc7c75f5
commit
c318d5e384
@ -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>
|
||||
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user