Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7087701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:42:23+00:00 2026-05-28T07:42:23+00:00

I have a simple jabber bot in python.. this use xmpppy (import xmpp), this

  • 0

I have a simple jabber bot in python.. this use xmpppy (import xmpp), this read command and return the output to who exec the command, fine.

I need accept automatically (by bot) the new friends requests, contacts..

any suggestions??

pd: this is a fragment of code:

self.cl = xmpp.Client(self.jid.getDomain(),debug=[])
    syslog.syslog("Conectando...")
    if not self.cl.connect(("jabber.org",5222)):
        raise IOError("No se pudo conectar con el server")
    syslog.syslog("Autenticando...")
    if not self.cl.auth(self.jid.getNode(),self.password):
        raise IOError("No se pudo autenticar el usuario")
    syslog.syslog("Registrando handler...")
    self.cl.RegisterHandler("message",self.messageHandler)
    self.cl.sendInitPresence()
def messageHandler(self,conn,mess):
    user = mess.getFrom().getStripped()
    text = mess.getBody()
    if text=="time":
        self.send(user,"Aqui son las " + datetime.datetime.now().strftime('%H:%M:%S'))
    elif text=="date":
        self.send(user,"Hoy es " + datetime.datetime.now().strftime("%d/%m/%Y"))
    elif text=="help":
        self.send(user,"Ayuda:\n - Para obtener la hora escribe: 'time'\n - Para obtener la fecha escribe: 'date'")
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:42:24+00:00Added an answer on May 28, 2026 at 7:42 am

    There’s a very helpful example project using xmpp by efcjoe on GitHub. The method you want is called add_friend (starts line 99):

    def add_friend(self, user):
        self._send(xmpp.Presence(to=user, typ='subscribed'))
        self._send(xmpp.Presence(to=user, typ='subscribe'))
        return True
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a simple Jabber client. I have downloaded this sample
I have simple python server and client. Server: import SocketServer import threading class MyTCPHandler(SocketServer.BaseRequestHandler):
I have simple SSIS package where I import data from flat file into SQL
I have simple python script, 'first.py': #first.py def firstFunctionEver() : print hello firstFunctionEver() I
I have simple map-reduce type algorithm, which I want to implement in python and
I have simple from written on C/gtk+ and i have function in this appliction.
i have simple side menu with this html code : <div id=menu> <div> Menu
I have simple user model: var user = Backbone.Model.extend({ initialize: function(){ this.bind(change:auth, function (){
I have simple chat program using WCF service. One service use for server and
I have simple front controller plugin which contains this code: http://pastebin.com/m155c59b0 When session expire

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.