Added tell command.

This commit is contained in:
Jeremy Fincher 2003-08-27 07:46:03 +00:00
parent 9550971042
commit bb1bdd2725
2 changed files with 19 additions and 0 deletions

View File

@ -701,6 +701,17 @@ class FunCommands(callbacks.Privmsg):
return
irc.reply(msg, s)
def tell(self, irc, msg, args):
"""<nick|channel> <text>
Tells the <nick|channel> whatever <text> is. Use nested commands to
your benefit here.
"""
(target, text) = privmsgs.getArgs(args, needed=2)
s = '%s wants me to tell you: %s' % (msg.nick, text)
irc.queueMsg(ircmsgs.privmsg(target, s))
raise callbacks.CannotNest
def dns(self, irc, msg, args):
"""<host|ip>"""
host = privmsgs.getArgs(args)

View File

@ -84,6 +84,14 @@ class FunCommandsTest(PluginTestCase):
i = ord(c)
self.assertResponse('ord %s' % utils.dqrepr(c), str(i))
def testTell(self):
m = self.getMsg('tell foo [rot13 foobar]')
self.failUnless(m.args[0] == 'foo')
self.failUnless('sbbone' in m.args[1])
m = self.getMsg('tell #foo [rot13 foobar]')
self.failUnless(m.args[0] == '#foo')
self.failUnless('sbbone' in m.args[1])
def testDns(self):
self.assertNotError('dns slashdot.org')