Added a Hebrew filter.

This commit is contained in:
Jeremy Fincher 2004-09-28 20:08:41 +00:00
parent 3139ffe909
commit 0704c34fc7
2 changed files with 17 additions and 1 deletions

View File

@ -96,7 +96,8 @@ class Filter(callbacks.Privmsg):
_filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp', _filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', 'lithp',
'scramble', 'morse', 'reverse', 'colorize', 'squish', 'scramble', 'morse', 'reverse', 'colorize', 'squish',
'supa1337', 'colorstrip', 'aol', 'rainbow', 'spellit'] 'supa1337', 'colorstrip', 'aol', 'rainbow', 'spellit',
'hebrew']
def outfilter(self, irc, msg, args, channel): def outfilter(self, irc, msg, args, channel):
"""[<channel>] [<command>] """[<channel>] [<command>]
@ -118,6 +119,17 @@ class Filter(callbacks.Privmsg):
irc.replySuccess() irc.replySuccess()
outfilter = privmsgs.checkChannelCapability(outfilter, 'op') outfilter = privmsgs.checkChannelCapability(outfilter, 'op')
def hebrew(self, irc, msg, args):
"""<text>
Removes all the vowels from <text>. (If you're curious why this is
named 'hebrew' it's because I (jemfinch) thought of it in Hebrew class,
and printed Hebrew often elides the vowels.)
"""
text = privmsgs.getArgs(args)
text = filter(lambda c: c not in 'aeiou', text)
irc.reply(text)
def squish(self, irc, msg, args): def squish(self, irc, msg, args):
"""<text> """<text>

View File

@ -41,6 +41,10 @@ class FilterTest(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('lithp meghan sweeney') self.assertNotError('lithp meghan sweeney')
self.assertNotError('aol I\'m too legit to quit.') self.assertNotError('aol I\'m too legit to quit.')
def testHebrew(self):
self.assertResponse('hebrew The quick brown fox '
'jumps over the lazy dog.',
'Th qck brwn fx jmps vr th lzy dg.')
def testJeffk(self): def testJeffk(self):
for i in range(100): for i in range(100):
self.assertNotError('jeffk the quick brown fox is ghetto') self.assertNotError('jeffk the quick brown fox is ghetto')