views:

219

answers:

2

Hello all,

I am trying to set up a Bonjour (or Ahavi) chatbot for our helpdesk system that would answer basic questions based on a menu system. The basis of my question is how do I get python to create the bot so that it connects to the network as a chat client.

Basically, anyone on my network with iChat or Empathy (or any chat program able to view users over the local network) should see the bot just as they see another user. The actual bot part would be quite simple to program, but I have no idea how to get it on the network.

I have looked into ZeroConf, but I'm not exactly sure how it works, or how to get a chat service running with python. I have seen references to pybonjour, python bindings for avahi, and pyzeroconf, but again, I have no idea how to set them up.

If anyone could give an example, or reference, or even a good article to read on the subject, it would be much appreciated. Thanks!

Kory

A: 

The easiest thing to do is to use Telepathy Salut or Pidgin/libpurple, and talk with it over D-Bus.

Ignacio Vazquez-Abrams
Thanks, I will definately look into that. I'm all for easy... Though using it this way, would it require having an X server running? I was hoping for something that could be run just on the console...
gali98
No, neither telepathy nor libpurple should require an X server, although libpurple does not support D-Bus activation.
Ignacio Vazquez-Abrams
Aha, very good then... This may be what I decide to use then... Though any other suggestions would also be welcome..Thanks very much!Kory
gali98
A: 

What you have here is a disconnect between what you want to do and how to do it. Zeroconf/Avahi are about service discovery. What you describe is a chat bot. Chat bots connect to an existing chat server. Apple with iChat has slightly blurred these lines.

iChat (and presumably other chat clients that implement the protocol) uses Bonjour to provide a means of avoiding outside server connections.

Essentially what you would need to do is to implement a chat server that also utilizes Bonjour. The Bonjour part advertises the service, and the chat portion handles the actual communication. You would likely want to use python libraries for telepathy such as python-telepathy or python-empathy [Telepathy][1]. iChat seems to speak AIM, so that would be the protocol to look into. IIRC it also supports XMPP so so the XMPP python libraries might be an option.

I'd look at using [bonjour-py][2] to advertise the service. It might be a bit tricky, but does sound interesting. The bonjour-py page has numerous other terms you can search on if it doesn't meet your needs.

[1]: http://telepathy.freedesktop.org/wiki/ Telepathy Home

[2]: http://www.mcs.anl.gov/research/projects/accessgrid/bonjour-py/ bonjour-py

The Real Bill