From f8974dd240e426d1f8d409746f4427bbf7c8151d Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Thu, 26 Jul 2012 19:53:20 -0500 Subject: [PATCH] TextTransform: add a !lower how i got so far without adding this i'll never know --- modules/TextTransform.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/TextTransform.py b/modules/TextTransform.py index d4948d1..f816db9 100644 --- a/modules/TextTransform.py +++ b/modules/TextTransform.py @@ -42,6 +42,8 @@ class TextTransform(Module): return self.reply(connection, event, reply[0]) elif self.upper(what, reply): return self.reply(connection, event, reply[0]) + elif self.lower(what, reply): + return self.reply(connection, event, reply[0]) elif self.al_bhed(what, reply): return self.reply(connection, event, reply[0]) @@ -84,6 +86,17 @@ class TextTransform(Module): reply[0] = text.upper() return True + def lower(self, what, reply): + """ + Convert a string to lowercase. + """ + + match = re.search('^!lower\s+(.*)$', what) + if match: + text = match.group(1) + reply[0] = text.lower() + return True + def al_bhed(self, what, reply): """ Convert a string to al bhed.