transform: use codecs library for rot13
This commit is contained in:
parent
c3c54b9f10
commit
59c593f60b
|
@ -1,6 +1,7 @@
|
|||
"""Assorted text transformations (e.g. rot13)."""
|
||||
|
||||
import base64
|
||||
import codecs
|
||||
|
||||
from ircbot.lib import Plugin
|
||||
|
||||
|
@ -40,7 +41,8 @@ class Transform(Plugin):
|
|||
"""Apply a rot13 method to the text."""
|
||||
|
||||
text = match.group(1)
|
||||
return self.bot.reply(event, text.encode('rot13', 'ignore'))
|
||||
encoder = codecs.getencoder('rot13')
|
||||
return self.bot.reply(event, encoder(text)[0])
|
||||
|
||||
def handle_base64(self, connection, event, match):
|
||||
"""Apply a base64 encoding to the text."""
|
||||
|
|
Loading…
Reference in New Issue