[Twisted-Python] Re: pretzel (and mudbot theory)
skreech at tranquility.net
Sat Oct 6 12:03:57 EDT 2001
> And for a bit of history -- this idea started with skreech and
> his old 'mudbot' program which he used to connect Quake servers,
> IRC, and his MUD. We thought it'd be fun to reimplement it (much
> better) in Twisted, so I'm helping him out.
pretzel already seems to be gone from CVS for some unexplained reason.
But maybe since it is I who had the original vision, I could possibly
explain what pretzel/mudbot is suppose to be.
It started when I hung out on a private mud a lot. A group of friends
liked to mud and eventually we setup a private mud and all we did on
it was talk. That is where Mudbot started, all it did was connect to
the mud and function as any other IRC bot would do. It did some
uninteresting things like executed certain commands and gave the
output of them to the mud, such as 'uptime' or the like. The next step
was to make it connect to more than one mud. That was completed, and
intermud communication was possible just like the ry bot on #python.
When the capability for 3 or more muds was hacked in, something
resembling the pretzel infrastructure began to materialize.
Eventually I wanted to be able to display a file easily to other
people on the mud without copying or pasting. Looking through python
docs I discovered 'fifos' and hacked it into mudbot. All I had to do
was "cat file > mudbot/fifo" and it was chatted onto the mud. At this
point I discovered that it could be possible to direct anything to
this fifo and have it display on the mud. I could "tail -f logfile >
mudbot/fifo" to a logfile, and it'd go to the mud. I liked this. Then
I tried starting a quake server on Linux, the local output of which is
text to the console, and redirecting this to the fifo made it possible
for people to play quake and for there to be something of an
"audience" on the mud. As we all liked to play quake, this was quite
Sometime around here I hacked in a little IRC support. I made it
possible for IRC <---> Mud communication. Naturally, this also allowed
for IRC <---> Fifo(and thus quake/logfiles)... coding in a real
console interface increased the number of input/output combinations.
Then I had The Idea.
I decided to recode mudbot completely. It was a desperate hack, I
hard-coded nearly everything. So I wrote some base mudbot code and
rewrote mud/irc/console/fifo capability into separately loadable
modules. At this timepoint however, I lost interest in muds because
the people I hung out with decided it was more fun to harass me and
my then-56k connection, so for personal reasons I didn't go back to
the mud, and thus I lost interest in ALL muds, leaving Mudbot as more
or less only an IRC bot on crack. So coding stopped before Mudbot's
second incarnation fully materialized. And so it was left
non-functional stuffed into a far corner in my home directory.
So what was this idea... my idea was that everything connected to the
mudbot had the capability to interact with everything else connected
to the mudbot in some orderly, standard way. Descriptions of Pretzel
have been so vague because we believe there's almost no limit to what
it would be able to accomplish. Naturally, the first module coded for
Pretzel (or UserAgent if you wish to call the module that) would be
IRC input/output support. That would allow Pretzel to talk to IRC.
Perhaps the second module would not be an input/output module, but a
data processing module, one that would simply test the concept. When
given a signal, it would output "Hello, world!". Data that comes
through IRC that says "hi" would signal (perhaps just call a method
of) the hello-world module, and the output of the hello-world module
is returned to the IRC module. The IRC module would be told to print
whatever comes from this hello-world module. The end result:
<skreech> pretzel: hi
<pretzel> Hello, world!
Other modules would be implemented. Data-processing modules that, say,
run programs and return their output, or perhaps generate a fortune
using the fortune program and return that. Or, for the ry killer, a
module that would simply take what is input and output it to another
input/output plugin. An ry killer could consist of four pieces:
1) IRC connection to efnet
2) IRC connection to ircnet
3) IRC connection to opn
4) Mirroring plugin
Where text coming in from every IRC connection would be directed
towards the mirroring plugin, and the mirroring plugin would be
designed to retransmit that message to every other IRC connection.
So what? That could be coded with Twisted within 30 minutes, you say.
Part of my goal, however, is to be able to program Pretzel's behavior
without touching any code. I should be able to rip out the mirroring
plugin, shove in a logfile plugin, connect the IRC connections to the
logfile plugin (I keep getting the mental image of PVC pipe pluming)
and make it a log-keeping bot, without seeing any code or even
restarting the bot. Granted, the flexibility of the bot will be
limited if you decide not to touch any code. If you use Pretzel and
decide, "hmm, I want people to know my uptime." then you could code a
module that adhered to the pretzel standard, shove it in to your
pretzel bot, hook it up to your IRC connection, and you'd have it. The
beauty of the system is that you coded it with the intention of using
it on IRC, but because it is a pretzel plugin, others can use the same
code to display the uptime on a Mud connection, or on Twisted.words,
or heck, a Quake server.
So that is my Mudbot/Pretzel theory. Thats the big idea. Any existing
IRC bot ought to be able to be replaced with Pretzel and a combination
of plugins, easily. Love it or hate it, give me your thoughts. But
again, its mysteriously missing from CVS as of about 5am zaibach-time
More information about the Twisted-Python