[Twisted-Python] Re: pretzel (and mudbot theory)

Kevin Turner acapnotic at twistedmatrix.com
Sun Oct 7 02:51:36 EDT 2001

Ok, here's a sketch of what I think of as an appropriately Twisted way
to do this.

An IRC bot of this sort amounts to the same thing as an IRC server.
Each exists in a number of rooms, has people log on and authenticate to
it, send it messages, sends messages back, etc.  The only difference[1]
is that an IRC server talks to its clients directly through a TCP port,
and the bot talks to them through some other IRC server.  Now, because
Twisted knows that services are independant of the transports which
connect to them, it already has a "transport" abstraction.

You should be able to use the IRC UserAgent as a transport in just the
same way as a tcp.Port...  
    PretzelUA("ry:irc.openprojects.net::6667:#python"), ...)

Now, for the features... what I would do is let features pass a trigger
regex and a callback function to the IRC server, which it would keep a
list of... and the features can send messages back if and when they see
(This is probably only speaking to one interface of the feature-service,
which may also have a web.Resource interface and a reality interface and
an enterprise interface and... just because Twisted is cool like that.
And, uh, isn't the phrase "it doesn't need to be distributed" pretty
blasphemous around here?)

As for skreech's bit about reprogramming/reconfiguring-without-editing-
code-or-restarting...  Well, I think that's been one of glyph's big
points about Twisted ever since, well, "as long as I can remember".  I
do remember this because I've disagreed with him about it at times.
=) Don't we still have that introduction/tutorial which demonstrates
telnet-in-to-the-web-server-to-change-its-configuration?  And now with
manhole out there as well...

Skreech, you have the benefit of experience here, as you've already
done at least two incarnations of this bot.  I just wanted to make
sure you're appropriately and sufficiently Twisted before you start
becoming Twisted. ;)

"It's not a cult, I swear"-ingly yours,

 - Kevin (Acap)

[1] "The only difference..."
    Well, ok, so there are a few wrinkles, i.e. certain communications
which may only happen between server and client will have to be
inhibited by the useragent-transport, because it may not be possible or
desirable to proxy them as client-client messages on the other side.

[PS] yeah, there are a whole *lot* of other details left before the
approach I describe can actually happen.  Which is why I introduced it
as a "sketch" instead of code.  =) 

Kevin Turner <acapnotic at twistedmatrix.com> | OpenPGP encryption welcome
The moon is waning gibbous, 81.6% illuminated, 18.9 days old.

More information about the Twisted-Python mailing list