mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-18 14:40:51 +01:00
Fixed shrink command.
This commit is contained in:
parent
a19bf090e5
commit
b8621f0c34
@ -619,7 +619,7 @@ class Filter(callbacks.Privmsg):
|
|||||||
irc.reply(' '.join(['GNU/' + s for s in text.split()]))
|
irc.reply(' '.join(['GNU/' + s for s in text.split()]))
|
||||||
gnu = wrap(gnu, ['text'])
|
gnu = wrap(gnu, ['text'])
|
||||||
|
|
||||||
def shrink(self, irc, msg, args):
|
def shrink(self, irc, msg, args, text):
|
||||||
"""<text>
|
"""<text>
|
||||||
|
|
||||||
Returns <text> with each word longer than
|
Returns <text> with each word longer than
|
||||||
@ -628,11 +628,12 @@ class Filter(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
L = []
|
L = []
|
||||||
minimum = self.registryValue('shrink.minimum', msg.args[0])
|
minimum = self.registryValue('shrink.minimum', msg.args[0])
|
||||||
for word in args:
|
for word in text.split():
|
||||||
if len(word) >= minimum:
|
if len(word) >= minimum:
|
||||||
word = '%s%s%s' % (word[0], len(word)-2, word[-1])
|
word = '%s%s%s' % (word[0], len(word)-2, word[-1])
|
||||||
L.append(word)
|
L.append(word)
|
||||||
irc.reply(' '.join(L))
|
irc.reply(' '.join(L))
|
||||||
|
shrink = wrap(shrink, ['text'])
|
||||||
|
|
||||||
|
|
||||||
Class = Filter
|
Class = Filter
|
||||||
|
@ -160,5 +160,6 @@ class FilterTest(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
def testShrink(self):
|
def testShrink(self):
|
||||||
self.assertResponse('shrink I love you', 'I l2e you')
|
self.assertResponse('shrink I love you', 'I l2e you')
|
||||||
self.assertResponse('shrink internationalization', 'i18n')
|
self.assertResponse('shrink internationalization', 'i18n')
|
||||||
|
self.assertResponse('shrink "I love you"', 'I l2e you')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user