Filter: add support for upper-case letters.

This commit is contained in:
Valentin Lorentz 2020-05-23 13:32:26 +02:00
parent b4d21127b1
commit ed87de1527
2 changed files with 3 additions and 2 deletions

View File

@ -756,13 +756,13 @@ class Filter(callbacks.Plugin):
vowelrot = wrap(vowelrot, ['text'])
_uwure = re.compile('[lr]')
_uwutrans = utils.str.MultipleReplacer(dict(list(zip('lrLR', 'wwWW'))))
def uwu(self, irc, msg, args, text):
"""<text>
Returns <text> in uwu-speak.
"""
text = self._uwure.sub('w', text)
text = self._uwutrans(text)
text += random.choice([''] * 10 + [' uwu', ' UwU', ' owo', ' OwO'])
irc.reply(text)
uwu = wrap(uwu, ['text'])

View File

@ -179,5 +179,6 @@ class FilterTest(ChannelPluginTestCase):
def testUwu(self):
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])?')
# vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: