From 96770e471e7e3b2263b6831deaf3a6e96290b438 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sun, 12 Feb 2017 15:54:01 +0100 Subject: [PATCH] [rutils] Remove a few commands --- COMMANDS.md | 5 ----- rutils.py | 29 ++--------------------------- 2 files changed, 2 insertions(+), 32 deletions(-) diff --git a/COMMANDS.md b/COMMANDS.md index eb5221e..d787efa 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -37,11 +37,6 @@ Required arguments are enclosed in { and }, optional arguments are enclosed in [ !rev {string} Reverse String Anyone !b64e {string} Base64-encode a string Anyone !b64d {string} Base64-decode a string Anyone - !b32e {string} Base32-encode a string Anyone - !b32d {string} Base32-decode a string Anyone - !b16e {string} Base16-encode a string Anyone - !b16d {string} Base16-decode a string Anyone - !hash {hashtype} {string} Hash a string, supports various hash functions Anyone !rand [min] {max} Says a random number between(incl.) min and max Anyone seen.py !seen {person} Output when person was last seen Anyone diff --git a/rutils.py b/rutils.py index 73570f4..87e0acd 100755 --- a/rutils.py +++ b/rutils.py @@ -4,7 +4,8 @@ rutils.py - Phenny Utility Module Copyright 2012, sfan5 Licensed under GNU General Public License v2.0 """ -import base64, binascii, re, random, time, multiprocessing, hashlib +import base64 +import random def rs(s): return repr(s)[1:-1] @@ -37,32 +38,6 @@ def make_thing(cmds, func): b64e = make_thing(['b64e','base64encode'], base64.b64encode) b64d = make_thing(['b64d','base64decode'], base64.b64decode) -b32e = make_thing(['b32e','base32encode'], base64.b32encode) -b32d = make_thing(['b32d','base32decode'], base64.b32decode) -b16e = make_thing(['b16e','base16encode'], base64.b16encode) -b16d = make_thing(['b16d','base16decode'], base64.b16decode) - -def hash_(phenny, input): - if not input.group(2): - return phenny.reply("Usage: hash | Get available hash funcs with ?") - hashfuncs = { - 'md5': hashlib.md5, - 'sha1': hashlib.sha1, - 'sha224': hashlib.sha224, - 'sha256': hashlib.sha256, - 'sha384': hashlib.sha384, - 'sha512': hashlib.sha512, - } - if input.group(2).strip() == '?': - return phenny.reply('Supported hash functions: ' + ', '.join(hashfuncs.keys())) - hashf = input.group(2).split(' ')[0] - if not hashf in hashfuncs: - return phenny.reply('Unknown hash functions, supported: ' + ', '.join(hashfuncs.keys())) - data = ' '.join(input.group(2).split(' ')[1:]).encode('utf-8') - phenny.say(hashfuncs[hashf](data).hexdigest()) - -hash_.commands = ['hash'] -hash_.priority = 'low' def rand(phenny, input): """Returns a random number"""