I'm making an ICQ (and XMPP in prospect) bot for a service, which should send and receive messages from users.
I'm using Python and Twisted. I started from the official documentation's example (this one: http://twistedmatrix.com/documents/current/words/examples/oscardemo.py)
So far I successfully receive and process messages from ICQ contacts. Now I need to send messages, but not in a respond to their message or some event. I need to send messages with Oscar (Twisted's thing for ICQ messaging) from outside the class with event handlers. How do I do that?
I'd appreciate any help since I fail to google anything useful, there's not so much about using Oscar out there.
When you connect
add a
Deferred
, which will be called when the connection is done:In the
get_B_instance
function, you can keep the reference to the instance of the protocol class.Then you can just call
sendMessage
on that instance.