Filter: Add uwu.

This commit is contained in:
Valentin Lorentz 2020-05-23 12:06:55 +02:00
parent a7a03513bf
commit b4d21127b1
2 changed files with 21 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class Filter(callbacks.Plugin):
_filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary', _filterCommands = ['jeffk', 'leet', 'rot13', 'hexlify', 'binary',
'scramble', 'morse', 'reverse', 'colorize', 'squish', 'scramble', 'morse', 'reverse', 'colorize', 'squish',
'supa1337', 'stripcolor', 'aol', 'rainbow', 'spellit', 'supa1337', 'stripcolor', 'aol', 'rainbow', 'spellit',
'hebrew', 'undup', 'gnu', 'shrink', 'uniud', 'capwords', 'hebrew', 'undup', 'uwu', 'gnu', 'shrink', 'uniud', 'capwords',
'caps', 'vowelrot'] 'caps', 'vowelrot']
@internationalizeDocstring @internationalizeDocstring
def outfilter(self, irc, msg, args, channel, command): def outfilter(self, irc, msg, args, channel, command):
@ -754,6 +754,19 @@ class Filter(callbacks.Plugin):
text = self._vowelrottrans(text) text = self._vowelrottrans(text)
irc.reply(text) irc.reply(text)
vowelrot = wrap(vowelrot, ['text']) vowelrot = wrap(vowelrot, ['text'])
_uwure = re.compile('[lr]')
def uwu(self, irc, msg, args, text):
"""<text>
Returns <text> in uwu-speak.
"""
text = self._uwure.sub('w', text)
text += random.choice([''] * 10 + [' uwu', ' UwU', ' owo', ' OwO'])
irc.reply(text)
uwu = wrap(uwu, ['text'])
Filter = internationalizeDocstring(Filter) Filter = internationalizeDocstring(Filter)
Class = Filter Class = Filter

View File

@ -173,4 +173,11 @@ class FilterTest(ChannelPluginTestCase):
self.assertResponse('shrink internationalization, localization', self.assertResponse('shrink internationalization, localization',
'i18n, l10n') 'i18n, l10n')
def testVowelrot(self):
self.assertResponse('vowelrot foo bar baz', 'fuu ber bez')
def testUwu(self):
for _ in range(100):
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: