Menu

Sending an IM

2006-06-27
2013-04-17
  • Nobody/Anonymous

    i'm building a bot that updates me with rss, but i can only make the bot reply to my IMs. Is there a way to make the bot send IMs actively?

     
    • Nobody/Anonymous

      btw, this is what i am doing:

      ImConversation convo = icbmService.getImConversation(new Screenname("asdf"));

      convo.sendMessage(new BasicInstantMessage("hello"));

      what does happen: the Conversation Listener gets the SentMessage event, but I never actually receive a message on AIM.

       
    • Nobody/Anonymous

      i think i know what the error is.

      I am trying to send message in OpenedServiceListener, but i think it's too early, the bot hasn't even signed on.  Is there an event that lets me know when the bot has finished initializing?  Then i could put my code somewhere else.

      THanks for your help!

       
    • Nobody/Anonymous

      It works when I wait a few seconds before sending the message - gives the bot time to init. However, if convo.sendMessage() doesn't work (because its too early), is there any way I can tell? convo.canSendMessage() returns true in all cases.

       
      • Keith Lea

        Keith Lea - 2006-06-30

        The solution is to wait for all services to be ready. I believe there's an event allServicesReady in openedserviceslistener, or something like that. You could also wait for the connection state to be ONLINE.

         
    • Colin Nicholls

      Colin Nicholls - 2006-07-08

      Sorry to barge in on this thread... I'm trying to do basically the same thing as Mr Nobody: just connect, send an IM, and disconnect. Thanks to your tip, I have a loop that tests for State.ONLINE, then calls conversation.sendMessage(). I don't get an error or anything, but I also don't seem to be successfully sending the IM. What do you suggested checking for next?

       
      • Keith Lea

        Keith Lea - 2006-07-12

        I think it's strange that it doesn't send. I suggest tracing the call through a debugger to figure out why it isn't sent. I'd liek to know the results.

         

Log in to post a comment.