From 7932c6078f580032fb6879508e82faa0f42d960e Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Mon, 25 Aug 2003 20:12:21 +0000 Subject: [PATCH] Added example, and made dice commaAndify its numbers. --- plugins/FunCommands.py | 84 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) diff --git a/plugins/FunCommands.py b/plugins/FunCommands.py index fc760b870..3b60564bf 100644 --- a/plugins/FunCommands.py +++ b/plugins/FunCommands.py @@ -64,6 +64,88 @@ import ircmsgs import privmsgs import callbacks +example = """ + @list FunCommands + base, binary, calc, chr, coin, cpustats, decode, dice, dns, encode, hexlify, kernel, last, lastfrom, leet, levenshtein, lithp, md5, mimetype, netstats, objects, ord, pydoc, rot13, rpn, sha, soundex, unhexlify, uptime, urlquote, urlunquote, xor + @netstats + I have received 211 messages for a total of 19535 bytes. I have sent 109 messages for a total of 8672 bytes. + @ord A + 65 + @chr 65 + A + @base 2 10101010101001010101010101 + 44733781 + @binary jemfinch + 0110101001100101011011010110011001101001011011100110001101101000 + (that's what the bits in a string look like for 'jemfinch') + @encode string-escape "\x00\x01" + \x00\x01 + @decode string-escape "\\x01\\x02" + '\x01\x02' + @hexlify jemfinch + 6a656d66696e6368 + @unhexlify 6a656d66696e6368 + jemfinch + @xor password The quick brown fox jumps over the lazy dog. + '$\t\x16S\x06\x1a\x1b\x07\x1bA\x11\x01\x18\x18\x1cD\x16\x0e\x0bS\x1d\x1a\x1f\x14\x03A\x1c\x05\x12\x1dR\x10\x18\x04S\x1f\x16\x15\x0bD\x14\x0e\x14]' + (now watch this -- a nested command :)) + @xor password [xor password The quick brown fox jumps over the lazy dog.] + The quick brown fox jumps over the lazy dog. + (xor is a reversible encryption method. It's easy to crack, so don't use it for real things :)) + @rot13 jemfinch + wrzsvapu + @rot13 [rot13 jemfinch] + jemfinch + @mimetype someSong.mp3 + audio/mpeg + @md5 jemfinch + cb2faabafafa9037493cf33779a2dc2e + @unhexlify [md5 jemfinch] + /7I<7y. + @sha jemfinch + b06a020b92ff41317f152139a4dda98f6c638812 + @coin + heads + @coin + heads + @coin + tails + @dice 2d20 + 3 and 10 + @lithp Sally sells seashells by the seashore. + THally thellth theathellth by the theathore. + @dice 4d100 + 25, 97, 85, and 93 + @leet All your base are belong to us!! + 411 y0ur b453 4r3 b310ng +0 uz!! + @cpustats + I have taken 5.4 seconds of user time and 0.29 seconds of system time, for a total of 5.69 seconds of CPU time. My children have taken 0.0 seconds of user time and 0.0 seconds of system time for a total of 0.0 seconds of CPU time. I've taken a total of 0.00329929635973% of this computer's time. Out of 2 spawned threads, I have 1 active. + @uptime + I have been running for 28 minutes and 47 seconds. + @calc e**(i*pi) + 1 + 0 + @calc 1+2+3 + 6 + @rpn 1 2 3 + + + 6 + @objects + I have 24941 objects: 234 modules, 716 classes, 5489 functions, 1656 dictionaries, 827 lists, and 14874 tuples (and a few other different types). I have a total of 119242 references. + @levenshtein supybot supbot + 1 + (taht's the edit distance between "supybot" and "supbot") + @soundex jemfinch + J515 + @soundex supercallifragilisticexpealadocious + S162 + @soundex supercallifragilisticexpealadocious 20 + S1624162423221432200 + @pydoc str + str(object) -> string. Return a nice string representation of the object. If the argument is a string, the return value is the same object. + @dns kernel.org + 204.152.189.116 + @kernel +""" + class FunCommands(callbacks.Privmsg): def __init__(self): callbacks.Privmsg.__init__(self) @@ -304,7 +386,7 @@ class FunCommands(callbacks.Privmsg): L = [0] * dice for i in xrange(dice): L[i] = random.randrange(1, sides+1) - irc.reply(msg, ', '.join([str(x) for x in L])) + irc.reply(msg, utils.commaAndify([str(x) for x in L])) else: irc.error(msg, 'Dice must be of the form d')