diff --git a/core/main.py b/core/main.py index 7af9934..eed71c8 100644 --- a/core/main.py +++ b/core/main.py @@ -26,6 +26,9 @@ class Input(object): def reply(self, msg): self.say(self.nick + ': ' + msg) + def pm(self, msg): + self.conn.msg(self.nick, msg) + def run(func, input): ac = func.func_code.co_argcount diff --git a/plugins/babel.py b/plugins/babel.py index 86a0bb2..23e4be4 100644 --- a/plugins/babel.py +++ b/plugins/babel.py @@ -57,6 +57,11 @@ def babel_gen(inp): @hook.command def babel(inp): + ".babel -- translates through multiple languages" + + if not inp: + return babel.__doc__ + try: return list(babel_gen(inp))[-1][2] except IOError, e: @@ -65,6 +70,11 @@ def babel(inp): @hook.command def babelext(inp): + ".babelext -- like .babel, but with more detailed output" + + if not inp: + return babelext.__doc__ + try: babels = list(babel_gen(inp)) except IOError, e: diff --git a/plugins/bf.py b/plugins/bf.py index ce9fac7..610fc19 100644 --- a/plugins/bf.py +++ b/plugins/bf.py @@ -13,7 +13,10 @@ MAX_STEPS = 1000000 @hook.command def bf(inp): - """Runs a Brainfuck program.""" + ".bf -- executes brainfuck program """ + + if not inp: + return bf.__doc__ program = re.sub('[^][<>+-.,]', '', inp) diff --git a/plugins/bible.py b/plugins/bible.py index 11fe18a..bc41a30 100644 --- a/plugins/bible.py +++ b/plugins/bible.py @@ -6,6 +6,11 @@ from util import hook @hook.command('god') @hook.command def bible(inp): + ".bible -- gets from the Bible (ESV)" + + if not inp: + return bible.__doc__ + base_url = 'http://www.esvapi.org/v2/rest/passageQuery?key=IP&' \ 'output-format=plain-text&include-heading-horizontal-lines&' \ 'include-headings=false&include-passage-horizontal-lines=false&' \ diff --git a/plugins/dice.py b/plugins/dice.py index fcb5522..13bb040 100644 --- a/plugins/dice.py +++ b/plugins/dice.py @@ -31,7 +31,7 @@ def nrolls(count, n): @hook.command def dice(inp): - ".dice - simulates dicerolls, e.g. .dice 2d20-d5+4 roll 2 " \ + ".dice -- simulates dicerolls, e.g. .dice 2d20-d5+4 roll 2 " \ "D20s, subtract 1D5, add 4" if not inp.strip(): return dice.__doc__ diff --git a/plugins/explain.py b/plugins/explain.py index 75537ae..082fdbe 100755 --- a/plugins/explain.py +++ b/plugins/explain.py @@ -3,9 +3,9 @@ from pycparser.cdecl import explain_c_declaration @hook.command('explain') def explain(inp): - ".explain -- gives an explanation of x expression" + ".explain -- gives an explanation of C expression" if not inp: - return "" + return explain.__doc__ try: result = explain_c_declaration(inp.rstrip()) diff --git a/plugins/hash.py b/plugins/hash.py index 5df4e47..99a2b84 100644 --- a/plugins/hash.py +++ b/plugins/hash.py @@ -15,5 +15,6 @@ def sha1(inp): @hook.command def hash(inp): + ".hash -- returns hashes of " return ', '.join(x + ": " + getattr(hashlib, x)(inp).hexdigest() for x in 'md5 sha1 sha256'.split()) diff --git a/plugins/profile.py b/plugins/profile.py index b3b2c5c..a6faee2 100644 --- a/plugins/profile.py +++ b/plugins/profile.py @@ -5,5 +5,9 @@ from util import hook @hook.command def profile(inp): + ".profile -- links to 's profile on SA" + if not inp: + return profile.__doc__ + return 'http://forums.somethingawful.com/member.php?action=getinfo' + \ '&username=' + '+'.join(inp.split()) diff --git a/plugins/pyexec.py b/plugins/pyexec.py index d0b5542..f6e3e78 100644 --- a/plugins/pyexec.py +++ b/plugins/pyexec.py @@ -9,6 +9,11 @@ re_lineends = re.compile(r'[\r\n]*') @hook.command def py(inp): + ".py -- executes python code " + + if not inp: + return py.__doc__ + res = urllib.urlopen("http://eval.appspot.com/eval?statement=%s" % urllib.quote(inp.strip(), safe='')).readlines() if len(res) == 0: diff --git a/plugins/seen.py b/plugins/seen.py index bc0a539..1bbcc60 100644 --- a/plugins/seen.py +++ b/plugins/seen.py @@ -32,7 +32,7 @@ def seeninput(bot, input): @hook.command def seen(bot, input): - ".seen - Tell when a nickname was last in active in irc" + ".seen -- Tell when a nickname was last in active in irc" if len(input.msg) < 6: return seen.__doc__ diff --git a/plugins/tell.py b/plugins/tell.py index 0d54bbc..ee5327f 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -48,7 +48,7 @@ def tellinput(bot, input): @hook.command def showtells(bot, input): - ".showtells - View all pending tell messages (sent in PM)." + ".showtells -- view all pending tell messages (sent in PM)." dbpath = os.path.join(bot.persist_dir, dbname) conn = dbconnect(dbpath) @@ -69,14 +69,14 @@ def showtells(bot, input): conn.commit() else: - input.msg(input.nick, "You have no pending tells.") + input.pm("You have no pending tells.") conn.close() @hook.command def tell(bot, input): - ".tell - Relay to the next time he talks" + ".tell -- relay to when is around" if len(input.msg) < 6: return tell.__doc__ diff --git a/plugins/twitter.py b/plugins/twitter.py index 0a6ad31..ddc4a2f 100644 --- a/plugins/twitter.py +++ b/plugins/twitter.py @@ -26,7 +26,8 @@ def unescape_xml(string): @hook.command def twitter(inp): - ".twitter / / - gets last/th tweet from /gets tweet " + ".twitter / //# -- gets last/th tweet from"\ + "/gets tweet /gets random tweet with #" inp = inp.strip() if not inp: return twitter.__doc__