Jabberbot

Matt Graves tunacubes at gmail.com
Wed Nov 13 17:12:16 CET 2013


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 = 'xxxxxx at xxxx.xxxx.com'
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. 



More information about the Python-list mailing list