[RUtils] Use repr on output
parent
bd10423067
commit
5f7b0ceb99
27
rutils.py
27
rutils.py
|
@ -5,6 +5,9 @@ Copyright 2012, Sfan5
|
|||
"""
|
||||
import base64, binascii
|
||||
|
||||
def rs(s):
|
||||
return repr(s)[1:-1]
|
||||
|
||||
def rev(phenny, input):
|
||||
"""reverse string"""
|
||||
for x in phenny.bot.commands["high"].values():
|
||||
|
@ -18,7 +21,7 @@ def rev(phenny, input):
|
|||
for i in range(1,len(q)):
|
||||
s += q[-i]
|
||||
s += q[0]
|
||||
return phenny.say(s)
|
||||
return phenny.say(rs(s))
|
||||
|
||||
rev.commands = ['rev','reverse']
|
||||
rev.priority = 'low'
|
||||
|
@ -33,7 +36,7 @@ def b64e(phenny, input):
|
|||
return phenny.reply("Nothing to encode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b64encode(q))
|
||||
return phenny.say(rs(base64.b64encode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -50,7 +53,7 @@ def b64d(phenny, input):
|
|||
return phenny.reply("Nothing to decode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b64decode(q))
|
||||
return phenny.say(rs(base64.b64decode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -67,7 +70,7 @@ def b32e(phenny, input):
|
|||
return phenny.reply("Nothing to encode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b32encode(q))
|
||||
return phenny.say(rs(base64.b32encode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -84,7 +87,7 @@ def b32d(phenny, input):
|
|||
return phenny.reply("Nothing to decode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b32decode(q))
|
||||
return phenny.say(rs(base64.b32decode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -101,7 +104,7 @@ def b16e(phenny, input):
|
|||
return phenny.reply("Nothing to encode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b16encode(q))
|
||||
return phenny.say(rs(base64.b16encode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -114,7 +117,7 @@ def b16d(phenny, input):
|
|||
return phenny.reply("Nothing to decode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(base64.b16decode(q))
|
||||
return phenny.say(rs(base64.b16decode(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -131,7 +134,7 @@ def crc32(phenny, input):
|
|||
return phenny.reply("Nothing to hash.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
h = binascii.crc32(q)
|
||||
return phenny.say(str(h) + "(" + hex(h) + ")")
|
||||
return phenny.say(rs(str(h) + "(" + hex(h) + ")"))
|
||||
|
||||
crc32.commands = ['crc32']
|
||||
crc32.priority = 'low'
|
||||
|
@ -146,7 +149,7 @@ def hex_(phenny, input):
|
|||
return phenny.reply("Nothing to hexlify.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(binascii.hexlify(q))
|
||||
return phenny.say(rs(binascii.hexlify(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -163,7 +166,7 @@ def unhex(phenny, input):
|
|||
return phenny.reply("Nothing to unhexlify.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(binascii.unhexlify(q))
|
||||
return phenny.say(rs(binascii.unhexlify(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -180,7 +183,7 @@ def uuencode(phenny, input):
|
|||
return phenny.reply("Nothing to encode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(binascii.b2a_uu(q))
|
||||
return phenny.say(rs(binascii.b2a_uu(q)))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
@ -197,7 +200,7 @@ def uudecode(phenny, input):
|
|||
return phenny.reply("Nothing to decode.")
|
||||
q = input.group(2).encode('utf-8')
|
||||
try:
|
||||
return phenny.say(binascii.a2b_uu(q + '\n'))
|
||||
return phenny.say(rs(binascii.a2b_uu(q + '\n')))
|
||||
except BaseException as e:
|
||||
return phenny.reply(e.message)
|
||||
|
||||
|
|
Loading…
Reference in New Issue