Skip to content

Instantly share code, notes, and snippets.

@pjlantz
Created July 6, 2010 10:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pjlantz/465219 to your computer and use it in GitHub Desktop.
Save pjlantz/465219 to your computer and use it in GitHub Desktop.
import sleekxmpp
def main() :
bot = GreetBot("echobot@pjlantz.com/HelloWorld", "mypass")
bot.run()
class GreetBot :
def __init__(self, jid, password) :
self.xmpp = sleekxmpp.ClientXMPP(jid, password)
self.xmpp.registerPlugin("xep_0045")
self.xmpp.add_event_handler("session_start", self.handleXMPPConnected)
def run(self) :
self.xmpp.connect()
self.xmpp.process(threaded=False)
def handleXMPPConnected(self, event):
self.xmpp.getRoster()
self.xmpp.sendPresence()
muc = self.xmpp.plugin["xep_0045"]
join = muc.joinMUC("test@conference.pjlantz.com", "echobot")
self.xmpp.sendMessage("test@conference.pjlantz.com", "Hello!", None, "groupchat")
if __name__ == "__main__" :
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment