TextTransform: add a !lower

how i got so far without adding this i'll never know
This commit is contained in:
Brian S. Stephan 2012-07-26 19:53:20 -05:00
parent 17040c1cde
commit f8974dd240
1 changed files with 13 additions and 0 deletions

View File

@ -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.