mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-24 19:14:09 +01:00
Filter: add support for upper-case letters.
This commit is contained in:
parent
b4d21127b1
commit
ed87de1527
@ -756,13 +756,13 @@ class Filter(callbacks.Plugin):
|
|||||||
vowelrot = wrap(vowelrot, ['text'])
|
vowelrot = wrap(vowelrot, ['text'])
|
||||||
|
|
||||||
|
|
||||||
_uwure = re.compile('[lr]')
|
_uwutrans = utils.str.MultipleReplacer(dict(list(zip('lrLR', 'wwWW'))))
|
||||||
def uwu(self, irc, msg, args, text):
|
def uwu(self, irc, msg, args, text):
|
||||||
"""<text>
|
"""<text>
|
||||||
|
|
||||||
Returns <text> in uwu-speak.
|
Returns <text> in uwu-speak.
|
||||||
"""
|
"""
|
||||||
text = self._uwure.sub('w', text)
|
text = self._uwutrans(text)
|
||||||
text += random.choice([''] * 10 + [' uwu', ' UwU', ' owo', ' OwO'])
|
text += random.choice([''] * 10 + [' uwu', ' UwU', ' owo', ' OwO'])
|
||||||
irc.reply(text)
|
irc.reply(text)
|
||||||
uwu = wrap(uwu, ['text'])
|
uwu = wrap(uwu, ['text'])
|
||||||
|
@ -179,5 +179,6 @@ class FilterTest(ChannelPluginTestCase):
|
|||||||
def testUwu(self):
|
def testUwu(self):
|
||||||
for _ in range(100):
|
for _ in range(100):
|
||||||
self.assertRegexp('uwu foo bar baz', 'foo baw baz( [uoUO]w[uoUO])?')
|
self.assertRegexp('uwu foo bar baz', 'foo baw baz( [uoUO]w[uoUO])?')
|
||||||
|
self.assertRegexp('uwu FOO BAR BAZ', 'FOO BAW BAZ( [uoUO]w[uoUO])?')
|
||||||
|
|
||||||
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79:
|
||||||
|
Loading…
Reference in New Issue
Block a user