From 36ecc4fcf642be6d9b1c2a3777d136c160acce0e Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sat, 30 Aug 2003 19:23:34 +0000 Subject: [PATCH] Added zen command. --- plugins/FunCommands.py | 10 ++++++++++ test/test_FunCommands.py | 3 +++ 2 files changed, 13 insertions(+) diff --git a/plugins/FunCommands.py b/plugins/FunCommands.py index 4366610fc..c946187d1 100644 --- a/plugins/FunCommands.py +++ b/plugins/FunCommands.py @@ -44,6 +44,7 @@ import sys import new import md5 import sha +import this import time import math import cmath @@ -757,6 +758,15 @@ class FunCommands(callbacks.Privmsg): """ irc.reply(msg, random.sample(self._eightballs, 1)[0]) + + _these = [str(s) for s in this.s.decode('rot13').splitlines() if s] + def zen(self, irc, msg, args): + """takes no arguments. + + Returns one of the zen of Python statements. + """ + irc.reply(msg, random.sample(self._these, 1)[0]) + def dns(self, irc, msg, args): """""" host = privmsgs.getArgs(args) diff --git a/test/test_FunCommands.py b/test/test_FunCommands.py index cc250fade..53b7e1a75 100644 --- a/test/test_FunCommands.py +++ b/test/test_FunCommands.py @@ -91,6 +91,9 @@ class FunCommandsTest(PluginTestCase): m = self.getMsg('tell #foo [rot13 foobar]') self.failUnless(m.args[0] == '#foo') self.failUnless('sbbone' in m.args[1]) + + def testZen(self): + self.assertNotError('zen') def testDns(self): self.assertNotError('dns slashdot.org')