Skip to content

Instantly share code, notes, and snippets.

@dongyuwei
Created February 2, 2012 03:01
Show Gist options
  • Save dongyuwei/1721142 to your computer and use it in GitHub Desktop.
Save dongyuwei/1721142 to your computer and use it in GitHub Desktop.
xmpp robot for weibo 微博XMPP私信机器人
require 'rubygems'
require 'eventmachine'
require 'xmpp4r-simple'
jabber = Jabber::Simple.new("[email protected]", "password_of_weibo")
#at_exit{jabber.status(:away, "jabot down")}
EM.run do
EM::PeriodicTimer.new(1) do
jabber.received_messages do |message|
case message.body
when "exit" : EM.stop
else jabber.deliver(message.from, "我收到你私信了: #{message.body}")
end
end
end
end
@dongyuwei
Copy link
Author

xmpp.weibo.com,email中的AT符号用“\40”替代即可 ​​​​

Ref: http://weibo.com/2758197137/zotjDgATb?type=comment#_rnd1491712190088
xmpp

@dongyuwei
Copy link
Author

xmpp2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment