diff --git a/plugins/cypher.py b/plugins/cypher.py index f16fc2e..1527778 100755 --- a/plugins/cypher.py +++ b/plugins/cypher.py @@ -35,9 +35,3 @@ def decypher(inp): passwd = inp.split(" ")[0] inp = " ".join(inp.split(" ")[1:]) return decode(passwd,inp) - - -@hook.command -def rot13(inp): - """rot13 -- Encode with rot13.""" - return inp.encode('rot13') diff --git a/plugins/hash.py b/plugins/hash.py deleted file mode 100755 index 7db8109..0000000 --- a/plugins/hash.py +++ /dev/null @@ -1,9 +0,0 @@ -import hashlib -from util import hook - - -@hook.command -def hash(inp): - """hash -- Returns hashes of .""" - return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest() - for x in ['md5', 'sha1', 'sha256']) diff --git a/plugins/length.py b/plugins/length.py deleted file mode 100644 index 9db7199..0000000 --- a/plugins/length.py +++ /dev/null @@ -1,7 +0,0 @@ -from util import hook - - -@hook.command -def length(inp): - """length -- gets the length of """ - return "The length of that message is {} characters.".format(len(inp)) diff --git a/plugins/utility.py b/plugins/utility.py new file mode 100644 index 0000000..9e1971d --- /dev/null +++ b/plugins/utility.py @@ -0,0 +1,42 @@ +from util import hook +import hashlib + +# basic text tools + +@hook.command +def upper(inp): + """upper -- Convert string to uppercase.""" + return inp.upper() + +@hook.command +def lower(inp): + """lower -- Convert string to lowercase.""" + return inp.lower() + +@hook.command +def titlecase(inp): + """title -- Convert string to title case.""" + return inp.title() + + +# encoding + +@hook.command +def rot13(inp): + """rot13 -- Encode with rot13.""" + return inp.encode('rot13') + +# length + +@hook.command +def length(inp): + """length -- gets the length of """ + return "The length of that string is {} characters.".format(len(inp)) + +# hashing + +@hook.command +def hash(inp): + """hash -- Returns hashes of .""" + return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest() + for x in ['md5', 'sha1', 'sha256'])