PDA

View Full Version : SupyBot 0.60.0!


jemfinch
08-30-2002, 09:26 AM
(someone's going to have to tell me if they're getting tired of these major release announcements...)

Anyway, soon later today I'll be uploading my new-fangled SupyBot-0.60.0.tar.bz2 to http://www.sf.net/projects/supybot/ for the whole world to download! Your IRC Botting fun will no doubt QUADRUPLE as a result of the awesome new "nested commands" capability -- Oh yes, here are some examples of how much nested commands rock:


<jemfinch`> @xor password [xor password 'The quick brown fox jumps over the lazy dog!']
<supybot> jemfinch`: 'The quick brown fox jumps over the lazy dog!'
<jemfinch`> @unhexlify [hexlify foo bar baz]
<supybot> jemfinch`: foo bar baz
<jemfinch`> @leet [netstats]
<supybot> jemfinch`: 1 h4v3 r3c3!v3d 59 m3554g3z f0r 4 +0+41 0f 5939 by+3z. 1 h4v3 53n+ 7 m3554g3z f0r 4 +0+41 0f 244 by+3z.
<jemfinch`> @rot13 [country .us]
<supybot> jemfinch`: Ab fhpu pbhagel sbhaq.
<jemfinch`> @rot13 [rot13 [country .us]]
<supybot> jemfinch`: No such country found.
<jemfinch`> @port [calc 0xFF]
<supybot> jemfinch`: Port 255.0 not found.
<jemfinch`> :)
<jemfinch`> @reverse [progstats]
<supybot> jemfinch`: .])laiceps niwgyc( 5-3.59.2 CCG[ )42:75:50 ,2002 32 guA ,1#( 1.2.2 nohtyP no gninnuR ."yp.fnocym c- yp.tob/crs" enil dnammoc eht htiw "tobypus/nohtyp/ym/crs/rehcniF ymereJ/emoh/" yrotcerid morf "315" puorg sa dna "rehcniF ymereJ" resu sa gninnur 6123 DI ssecorP
<jemfinch`> @reverse [reverse [progstats]]
<supybot> jemfinch`: Process ID 3216 running as user "Jeremy Fincher" and as group "513" from directory "/home/Jeremy Fincher/src/my/python/supybot" with the command line "src/bot.py -c myconf.py". Running on Python 2.2.1 (#1, Aug 23 2002, 05:57:24) [GCC 2.95.3-5 (cygwin special)].
<jemfinch`> @[reverse 5dm] jemfinch
<supybot> jemfinch`: cb2faabafafa9037493cf33779a2dc2e


And, of course, new Http-based callbacks, courtesy of inkedmn and GnuVince!


<jemfinch`> @foldoc esr
<supybot> jemfinch`: person One of the authors of the Hacker's Jargon File Eric was involved in the JOLT project and GNU Emacs as well as maintaining several FAQ lists. He is a keen advocate of open source
<jemfinch`> @stockquote RHAT
<supybot> jemfinch`: The current price of RHAT is 4.98, as of 3:59pm EST. A change of 0.000 from the last business day.
<jemfinch`> @cfactive
<supybot> jemfinch`: jemfinch


And there's more to come! Just wait until the next release :) Anyway, check out the project page later today for the newly uploaded 0.60.0 release, and get testing and coding!

***Boring Internal Stuff***

The API for threaded callbacks changed slightly; Now, unthreaded callbacks should subclass callbacks.Privmsg, and threaded callbacks should subclass callbacks.ThreadedPrivmsg. ThreadedPrivmsg has threadsafe versions of self.reply and self.replyPrivate which have a different signature than before; they require the irc and msg arguments in addition to the string.

I wrote a new superReload; I'm still working out some kinks, the only known bug (but surely not the only bug :)) is that you cannot, I repeat, CANNOT reload ircutils.py. But now I can reload new-style classes, so all my classes are new-style now :)

I've started writing a ChannelStats module; right now it only does @seen, but if someone wants to extend it to do a wider variety of channel statistics, that'd be awesome.

There have been slight improvements to the telnet-REPL.

This release is *nice*. I'm winding down the things that can be done in the IRC Bot framework; soon, it'll only be more features or more commands to add. But that'll be nice when it is :)

Thanks for the all the support, guys!

Jeremy

GnuVince
08-30-2002, 01:10 PM
Great! I guess I have other modules I can write for you; how would you like a nslookup module?

inkedmn
08-30-2002, 04:57 PM
/me brainstorms for new module ideas...

inkedmn
08-30-2002, 11:54 PM
ahem...

release? ;)

</impatient punk>

GnuVince
08-31-2002, 06:19 PM
def nslookup(self, irc, msg, args):
host = args[0]
if re.search(r'\d{1,3}[.]\d{1,3}[.]\d{1,3}[.]\d{1,3}', host):
hostname = socket.getfqdn(host)
if hostname == host:
self.reply("host not found")
else:
self.reply("%s -> %s" % (host, hostname))
else:
try:
hostname = socket.gethostbyname(host)
self.reply("%s -> %s" % (host, hostname))
except socket.error:
self.reply("host not found")

inkedmn
08-31-2002, 06:49 PM
nice work, friend :)

jemfinch
09-02-2002, 06:29 PM
Ah...I woke up late Friday afternoon and had to speed my butt up to get a haircut and head out to visit my girlfriend...sorry guys, she's more important than releasing 0.60.0 :D I'll make the release tonight.

GnuVince: Look at the ircutils module, there's already an ircutils.isIP function to check if something's an IP.

Jeremy

inkedmn
09-02-2002, 07:25 PM
jeremy,

any other modules you're needing? i've got some time today, but no creativity :)

jemfinch
09-03-2002, 12:30 AM
I still need the News and Notes modules described on sf.net.

Jeremy

jemfinch
09-03-2002, 12:45 AM
Ok, GnuVince, your code is integrated into the 0.60.0 release, in modified form. Here's what I put:


def nslookup(self, irc, msg, args):
"<host|ip>"
host = self.getArgs(args)
if ircutils.isIP(host):
hostname = socket.getfqdn(host)
if hostname == host:
self.error('Host not found.')
else:
self.reply(irc, msg, hostname)
else:
try:
ip = socket.gethostbyname(host)
self.reply(irc, msg, ip)
except socket.error:
self.error('Host not found.')


First, if you haven't noticed, I'm really anal about capitals and punctuation, so "host not found" becomes "Host not found."

Second, you should never access args directly. Always use self.getArgs, because it gives a proper help message when a command is used incorrectly; in your version, "nslookup" would just return "IndexError: 0", but in my version, "nslookup" would return "nslookup <host|ip>". As a corrolary, always include a docstring for your commands so error reporting works properly.

I just changed the return format to be less...redundant :)

I used my ircutils.isIP function because that's more efficient and consistent than using a hand-rolled regexp.

Thanks for the callback!

Jeremy

jemfinch
09-03-2002, 03:32 PM
There are several bugs in this release...

I moved the quotes module to sandbox at the last minute, pending some infrastructure change in those types of modules. If it's being loaded, you'll get an error.

The "crypt" command doesn't work in Windows, and raises an ImportError. Just do the same thing I did for the "progstats" command and the pwd module.

data/ports.db is in a separate distribution (not yet online). Include your own one for now (you should have one from prior distributions).

The Anagrams module doesn't have its anagram database. You can wait for me to upload the 4mb tarball of standard data/ stuff, or you can make your own -- just run the module itself like this:

plugins/anagrams.py < dict

Where "dict" is your own dictionary file, a file with one word on each line. It'll take a long time; I don't build the dictionary in the fastest way possible (in order to test some of my cdb module :))

Jeremy

jemfinch
09-09-2002, 01:09 AM
Hmm...just posting a new module (untested) that I'll copy into the bot when I get back to my own computer. This'll keep me from having to floppynet it back up to Columbus...


class CrapList(callbacks.Privmsg):
def __init__(self, hostmasks):
self.hostmasks = hostmasks

def inFilter(self, irc, msg):
for hostmask in hostmasks:
if ircutils.hostmaskPatternEqual(hostmask, msg.prefix):
return None
return msg

def addcrap(self, irc, msg, args):
"<hostmask pattern>"
hostmask = self.getArgs(args)
if ircdb.checkCapability(msg.prefix, 'admin'):
self.hostmasks.append(hostmask)
self.reply(conf.replySuccess)
else:
self.error(conf.replyNoCapability % 'admin')

def delcrap(self, irc, msg, args):
"<hostmask pattern>"
hostmask = self.getArgs(args)
if ircdb.checkCapability(msg.prefix, 'admin'):
self.hostmasks = [hostmask_ for hostmask_ in self.hostmasks if hostmask != hostmask_]
self.reply(conf.replySuccess)
else:
self.error(conf.replyNoCapability % 'admin')


Thanks for the space, CoderForums :)

Jeremy