diff --git a/plugins/Format/plugin.py b/plugins/Format/plugin.py index 5e3e4611a..0a00f38cb 100644 --- a/plugins/Format/plugin.py +++ b/plugins/Format/plugin.py @@ -99,6 +99,15 @@ class Format(callbacks.Plugin): translate = wrap(translate, ['something', 'something', 'text']) @internationalizeDocstring + def replace(self, irc, msg, args, bad, good, text): + """ + + Replaces all non-overlapping occurrences of + with in . + """ + irc.reply(text.replace(bad, good)) + replace = wrap(replace, ['something', 'something', 'text']) + def upper(self, irc, msg, args, text): """ diff --git a/plugins/Format/test.py b/plugins/Format/test.py index 3bbf14602..f891e0dd7 100644 --- a/plugins/Format/test.py +++ b/plugins/Format/test.py @@ -54,6 +54,10 @@ class FormatTestCase(PluginTestCase): def testTranslate(self): self.assertResponse('translate 123 456 1234567890', '4564567890') + self.assertError('translate 123 1234 123125151') + + def testReplace(self): + self.assertResponse('replace # %23 bla#foo', 'bla%23foo') def testUpper(self): self.assertResponse('upper foo', 'FOO')