Made new utility plugin with hash, length and other text formatting commands
This commit is contained in:
parent
a16b1776f8
commit
52b14b367a
|
@ -35,9 +35,3 @@ def decypher(inp):
|
||||||
passwd = inp.split(" ")[0]
|
passwd = inp.split(" ")[0]
|
||||||
inp = " ".join(inp.split(" ")[1:])
|
inp = " ".join(inp.split(" ")[1:])
|
||||||
return decode(passwd,inp)
|
return decode(passwd,inp)
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def rot13(inp):
|
|
||||||
"""rot13 <string> -- Encode <string> with rot13."""
|
|
||||||
return inp.encode('rot13')
|
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
import hashlib
|
|
||||||
from util import hook
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def hash(inp):
|
|
||||||
"""hash <text> -- Returns hashes of <text>."""
|
|
||||||
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
|
|
||||||
for x in ['md5', 'sha1', 'sha256'])
|
|
|
@ -1,7 +0,0 @@
|
||||||
from util import hook
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command
|
|
||||||
def length(inp):
|
|
||||||
"""length <message> -- gets the length of <message>"""
|
|
||||||
return "The length of that message is {} characters.".format(len(inp))
|
|
42
plugins/utility.py
Normal file
42
plugins/utility.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
from util import hook
|
||||||
|
import hashlib
|
||||||
|
|
||||||
|
# basic text tools
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def upper(inp):
|
||||||
|
"""upper <string> -- Convert string to uppercase."""
|
||||||
|
return inp.upper()
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def lower(inp):
|
||||||
|
"""lower <string> -- Convert string to lowercase."""
|
||||||
|
return inp.lower()
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def titlecase(inp):
|
||||||
|
"""title <string> -- Convert string to title case."""
|
||||||
|
return inp.title()
|
||||||
|
|
||||||
|
|
||||||
|
# encoding
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def rot13(inp):
|
||||||
|
"""rot13 <string> -- Encode <string> with rot13."""
|
||||||
|
return inp.encode('rot13')
|
||||||
|
|
||||||
|
# length
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def length(inp):
|
||||||
|
"""length <string> -- gets the length of <string>"""
|
||||||
|
return "The length of that string is {} characters.".format(len(inp))
|
||||||
|
|
||||||
|
# hashing
|
||||||
|
|
||||||
|
@hook.command
|
||||||
|
def hash(inp):
|
||||||
|
"""hash <string> -- Returns hashes of <string>."""
|
||||||
|
return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest()
|
||||||
|
for x in ['md5', 'sha1', 'sha256'])
|
Reference in a new issue