Jabberbot

M

Matt Graves

I'm using the jabberbot library and there is not a whole lot of documentation on it. Does anyone have experience with this library?

This is basically the only example given:


-------------------------
from jabberbot import JabberBot, botcmd
import datetime

class SystemInfoJabberBot(JabberBot):
@botcmd
def serverinfo( self, mess, args):
"""Displays information about the server"""
version = open('/proc/version').read().strip()
loadavg = open('/proc/loadavg').read().strip()

return '%s\n\n%s' % ( version, loadavg, )

@botcmd
def time( self, mess, args):
"""Displays current server time"""
return str(datetime.datetime.now())

@botcmd
def rot13( self, mess, args):
"""Returns passed arguments rot13'ed"""
return args.encode('rot13')

@botcmd
def whoami(self, mess, args):
"""Tells you your username"""
return mess.getFrom().getStripped()


username = '(e-mail address removed)'
password = 'xxxxx'
bot = SystemInfoJabberBot(username,password)
bot.serve_forever()

-------------------------
I cannot figure out how I would have it simulate a conversation. For example, if I added

@botcmd
def Hello(self, mess, args):
return "Hi, how are you?"

how would I get it to carry on from here? To look for different answers to the response that was returned. Any bit of information would be appreciated.
 
M

Mark Lawrence

I'm using the jabberbot library and there is not a whole lot of documentation on it. Does anyone have experience with this library?

[snip code from http://thp.io/2007/python-jabberbot/]
I cannot figure out how I would have it simulate a conversation. For example, if I added

@botcmd
def Hello(self, mess, args):
return "Hi, how are you?"

how would I get it to carry on from here? To look for different answers to the response that was returned. Any bit of information would be appreciated.

From the link above "More examples

Starting with version 0.7, more examples can be found in the examples/
subdirectory of the source distribution."

Have you looked at these?
 
M

Matt Graves

I'm using the jabberbot library and there is not a whole lot of documentation on it. Does anyone have experience with this library?



[snip code from http://thp.io/2007/python-jabberbot/]


I cannot figure out how I would have it simulate a conversation. For example, if I added


def Hello(self, mess, args):
return "Hi, how are you?"

how would I get it to carry on from here? To look for different answers to the response that was returned. Any bit of information would be appreciated.



From the link above "More examples



Starting with version 0.7, more examples can be found in the examples/

subdirectory of the source distribution."



Have you looked at these?



--

Python is the second best programming language in the world.

But the best has yet to be invented. Christian Tismer



Mark Lawrence

I have, but unfortunately they are about just as clear as the example I posted. The examples they posted are relevant for certain things, but not what I'm looking to do.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top