Permalink
Browse files

Rot13 plugin

  • Loading branch information...
1 parent ce53591 commit e87a6fd7b53d6f6dacd0ff5e7d66f17424e31cfb @nibalizer nibalizer committed Jan 10, 2013
Showing with 23 additions and 0 deletions.
  1. +23 −0 hamper/plugins/commands.py
@@ -98,6 +98,28 @@ def command(self, bot, comm, groups):
args = groups[0].replace(' ', '+')
bot.reply(comm, target + 'http://lmgtfy.com/?q=' + args)
+class Rot13(ChatCommandPlugin):
+ """Encode secret messages."""
+ name = 'rot13'
+
+ class Rot13Command(Command):
+ name = 'rot13'
+ regex = '^rot13\s+(.*)'
+ onlyDirected = False
+
+ short_desc = 'rot13 - Encodes string using rot13 cipher.'
+ long_desc = ('The rot13 cipher rotates every letter to the '
+ 'other side of the alphabet. Applying it twice '
+ 'returns the original string.\n'
+ 'Example: !rot13 science yields fpvrapr'
+ ' and !rot13 fpvrapr yields science')
+
+ def command(self, bot, comm, groups):
+ target = ''
+ if comm['target']:
+ target = comm['target'] + ': '
+ args = groups[0].encode('rot13')
+ bot.reply(comm, target + args)
class Dice(ChatCommandPlugin):
"""Random dice rolls!"""
@@ -163,6 +185,7 @@ def command(self, bot, com, groups):
lmgtfy = LetMeGoogleThatForYou()
+rot13 = Rot13()
sed = Sed()
quit = Quit()
dice = Dice()

0 comments on commit e87a6fd

Please sign in to comment.