swiftone has asked for the wisdom of the Perl Monks concerning the following question:

In playing with the Perl plugin capabilities of GAIM, and in trying to experiment with POE (alt), I've amused myself with the Chatbot::Eliza (alt) module, but I seriously would like some additional functionality. Unfortunately, it seems most bot authors tie their bots tightly to their interface, which ruins them for me.

In poking about, I've found a development version of http://www.infobot.org/ that claims to have become modular, but the code is undocumented, and doesn't appear to have been touched in over a year. Likewise, I saw two claims at Re: It isn't human that Infobot had been modularized by araqnid and/or that it had become something called "Geckobot" (which is also on the infobot site, but is even older than the infobot dev code).

Likewise, the Alice code lacks a perl implementation (they even have PHP!?).

So am I out of luck? Will I have to try and take the bones of Infobot and (gasp!) do the work myself? Or am I missing something obvious? Eliza has such a clean interface, is it so difficult to get that elsewhere? How could Perl, of all languages, missed the boat on this kind of ability?

Replies are listed 'Best First'.
Re: Interface-clean Infobot
by djw (Vicar) on Jan 16, 2002 at 02:46 UTC
    I think what you are looking for is Perlbot. It has the modularity you are looking for, and is very well written (in my opinion). I tried Infobot as well as another perl based bot called 'bitchbot' and I still much prefer perlbot. Anyhow, go check the link to see if that is what you need. I beleive they are also looking for developer help in getting botnet support in for perlbot if you are intrested.

    djw
      I hadn't seen this one before, but it's still not what I'm looking for. Perlbot assumes an IRC connection. Perlbot takes control of the program flow. I'm looking for a bot that will passively wait for my program to hand it some data, give me a response to that data, and then return control of the program. Something like:
      use CleanBot; my $cleanbot = CleanBot->new('cleanbot-init.conf'); while($line=<get_data_from_a_source_the_bot_doesn't_care_about>){ my $response = $cleanbot->parse($line); Do_something_the_bot_doesn't_care_about($response) if $response; }
      So the above loop could be used for an IRC connection, a GAIM plugin, even an FTP client if I wanted one with attitude. The bot itself would be persistent during the connection (it could remember data from line to line), and it wouldn't be hard to have it be persistent from invocation to invocation.
Re: Interface-clean Infobot
by Zaxo (Archbishop) on Jan 16, 2002 at 01:43 UTC

    The CPAN search Eliza gives four modules in three packages. The most recent (OpenFrame) was released 2002/01/04, and the list includes My::Chatbot::Eliza in the popular SOAP::Lite package.

    After Compline,
    Zaxo

      I really don't understand your reply -- I said I want a bot package that can do more than Eliza, but with the same clean interface. Eliza works just fine, and the interface doesn't make any assumptions (it doesn't assume you are on IRC, it doesn't assume you're reading from a filehandle, etc). The problem is that only Eliza appears to have this clean interface.

      Did I clear up my desires, or am I still not making sense?

Re: Interface-clean Infobot
by Matts (Deacon) on Jan 16, 2002 at 14:51 UTC
    I'm not entirely certain what you're after. It seems to me what you want is basically POE, but with some sort of ability to tie that to other external systems, such as IRC, or GAIM, or perhaps the web.

    So maybe you could elaborate on what you're after. I'm in the midst of authoring POE::Component::IRC::Bot, which is based on PoCo::IRC, but makes bot writing simpler, however it seems you want something that's not even tied to IRC. Is that right?

    If that is right, then that seems to me to be POE in a nutshell. It's an excellent architecture for bots and/or finite state machines, and so seems ideal for what you're after.

      Yes and no. I want to have a a bot I can tie into any other program. In some cases, that may be a program I write using POE, in others it may be a different program (GAIM, for example) that already has event handlers/event loop structure. I guess I want a bot that ISN'T the main program.

      (It's probably possible to have two POE loops inside different modules, but I'm having enough trouble learning to write a main POE program without trying to figure out how to do that.)

      Let me see if I can provide a spec for what I want: I want a module that I can hand a line of text to, and get a line back from (and then control of the program is outside the bot module until I call on it again), much like the Eliza interface. Since this module would not be reading to/from a terminal, or a filehandle, or an IRC channel, or any kind of socket, etc, I could get that line of text from anywhere I wanted, and do anything I wanted with the results. Thus, if I wanted to plop an infobot into GAIM, it is easily done. If I wanted to add a chatbot to my (theoretical) POE-based poker server setup, it's easily done. For kicks, I could have those two bots interact in some fashion, since the bot code wouldn't care where the data comes from, as long as I write whatever code is necessary to get the data from one bot to another.

      The problem is that all of the Bot solutions I've seen "take control" of the interface. Perlbot, as mentioned above, talks to/from an IRC connection. Ditto for Infobot. I haven't looked into it too much, but it looks like POE::Component::IRC::Bot makes different (but still incompatible) assumptions about where the data is coming to/from.

      Does that clarify things? This is the sort of problem I've encountered with several things Perl-related (probably true in other languages, but I don't go there): The interface is assumed, which means that yoru code is useless for someone who doesn't have that interface. Imagine a solitaire game (In fact, I seem to recall an instance of this in the Perl Journal a while back). You could write a Tk-based solitaire game. OR, you could write an interface-neutral solitair module, and then a Tk interface to that module. IF someone down the line wanted to write a GTK-based solitaire, they could just write a new interface to the same codebase. If the solitaire is built in with the Tk interface, they'd have to fork it to create their new one, and may just start over from scratch.

      That's what I want to avoid. There are several perl bot packages out there, I have no desire to reinvent the wheel (I've done that enough, not to mention time constraints). However, none of those bot collections will let me put those bots in a non IRC environment.

      I'm all for POE, but it seems more appropriate for the structure that CALLS the bot module, not the bot module itself.

        (You may never see this, being a late reply)

        I totally understand what you want now. I guess it just needed some super-simplification :-)

        No, there's nothing like that. What we need is a base class Bot.pm, perhaps even a factory, or a feature machine. It would take "plugins" that would each get a chance to "see" the input, and when one is happy, it would return the results, whatever that may be. Yes, interesting indeed.

Re: Interface-clean Infobot
by Anonymous Monk on Jan 17, 2002 at 09:36 UTC
    You tool.

    http://150.161.189.220/cgi-bin/pixel/pixel_abrir.pl

    -> Alice in Perl.