Jabber Bot

2,376 views
2,268 views

Published on

Published in: Technology
0 Comments
5 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,376
On SlideShare
0
From Embeds
0
Number of Embeds
28
Actions
Shares
0
Downloads
44
Comments
0
Likes
5
Embeds 0
No embeds

No notes for slide

Jabber Bot

  1. 1. Jabber Bot By Ezwan Aizat bin Abdullah Faiz aizat.faiz@gmail.com http://aizatto.com http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  2. 2. http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  3. 3. http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382464/
  4. 4. http://flickr.com/photos/warmnfuzzy/466382464/
  5. 5. Who Am I? Go by many names Student ezwan aizat bin abdullah faiz Web Developer aizatto That out of shape zatto guy trying to climb a mountain
  6. 6. Warning! http://tango.freedesktop.org
  7. 7. There will be CODE http://tango.freedesktop.org
  8. 8. a persons ability to type/code is greatly impaired when presenting http://tango.freedesktop.org
  9. 9. BDD Behavior Driven Development http://behaviour-driven.org/ http://en.wikipedia.org/wiki/Behavior_Driven_Development http://flickr.com/photos/baboon/3946055/
  10. 10. What is Jabber?
  11. 11. What is XMPP? eXtensible Messaging and Presence Protocol http://en.wikipedia.org/wiki/XMPP
  12. 12. why? http://flickr.com/photos/genewolf/147722495/
  13. 13. fun http://flickr.com/photos/evank750i/306288390/
  14. 14. services built on top of
  15. 15. Straw Poll http://strawpollnow.com
  16. 16. foamee http://foamee.com
  17. 17. under construction...
  18. 18. monitoring http://flickr.com/photos/parl/3231111/
  19. 19. any other ideas? http://flickr.com/photos/genewolf/147722495/
  20. 20. Lets start CODING! http://flickr.com/photos/warmnfuzzy/466382456/
  21. 21. RubyGems Execute: sudo gem install xmpp4r ZenTest rspec daemons Optional: sudo gem install hpricot http://flickr.com/photos/mikeleary83/1729114228/
  22. 22. Setup Directory Structure Execute: mkdir -p xmpp/{autotest,bin,db,config,lib,spec/sample} http://flickr.com/photos/mikeleary83/1729114228/
  23. 23. Setup Autotest File: ./autotest/discover.rb Contents: Autotest.add_discovery do quot;rspecquot; end Execute: autotest http://flickr.com/photos/mikeleary83/1729114228/
  24. 24. Create Spec for Client#apply_rules(message) File: ./spec/client_spec.rb http://flickr.com/photos/mikeleary83/1729114228/
  25. 25. Implement Client#apply_rules(message) File: ./lib/client.rb http://flickr.com/photos/mikeleary83/1729114228/
  26. 26. We would like to use actual XMPP messages We would like to use actual XMPP messages, serialized Need to capture them somehow Create Daemon to serialize messages, easier to recreate messages http://flickr.com/photos/mikeleary83/1729114228/
  27. 27. Create Daemon File: ./config/jabber.yml File: ./bin/daemon.rb http://flickr.com/photos/mikeleary83/1729114228/
  28. 28. Create Daemon Start: ruby bin/daemon.rb start Stop: ruby bin/daemon.rb stop http://flickr.com/photos/mikeleary83/1729114228/
  29. 29. Wait for Tweets to come in and serialize http://flickr.com/photos/mikeleary83/1729114228/
  30. 30. or use sample ones... http://flickr.com/photos/mikeleary83/1729114228/
  31. 31. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:2877533quot; to=quot;aizat.faiz@gmail.comquot;> <body>seanx2: @strawpoll cat KITTIES FTW!!!</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / seanx2</title> <link href=quot;http://twitter.com/seanx2quot;/> <link href=quot;http://twitter.com/statuses/user_timeline/seanx2.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>seanx2</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/24969932/ seanx2_normal.png</icon> </source> <title>seanx2: @strawpoll cat KITTIES FTW!!!</title> <summary>seanx2: @strawpoll cat KITTIES FTW!!!</summary> <link href=quot;http://twitter.com/seanx2/statuses/777710064quot; rel=quot;alternatequot; type=quot;text/ htmlquot;/> <id>tag:twitter.com,2008-03-27T01:10:41+00:00:/statuses/777710064</id> <published>2008-03-27T01:10:41+00:00</published> <updated>2008-03-27T01:10:41+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  32. 32. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:2877533quot; to=quot;aizat.faiz@gmail.comquot;> <body>seanx2: @strawpoll cat KITTIES FTW!!!</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / seanx2</title> <link href=quot;http://twitter.com/seanx2quot;/> <link href=quot;http://twitter.com/statuses/user_timeline/seanx2.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>seanx2</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/24969932/ seanx2_normal.png</icon> </source> <title>seanx2: @strawpoll cat KITTIES FTW!!!</title> <summary>seanx2: @strawpoll cat KITTIES FTW!!!</summary> <link href=quot;http://twitter.com/seanx2/statuses/777710064quot; rel=quot;alternatequot; type=quot;text/ htmlquot;/> <id>tag:twitter.com,2008-03-27T01:10:41+00:00:/statuses/777710064</id> <published>2008-03-27T01:10:41+00:00</published> <updated>2008-03-27T01:10:41+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  33. 33. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:952601quot; to=quot;aizat.faiz@gmail.comquot;> <body>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / rajaseelan</title> <link href=quot;http://twitter.com/rajaseelanquot;/> <link href=quot;http://twitter.com/statuses/user_timeline/rajaseelan.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>rajaseelan</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/36242282/raja- profile_normal.png</icon> </source> <title>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</title> <summary>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</summary> <link href=quot;http://twitter.com/rajaseelan/statuses/777649976quot; rel=quot;alternatequot; type=quot;text/htmlquot;/> <id>tag:twitter.com,2008-03-26T22:48:10+00:00:/statuses/777649976</id> <published>2008-03-26T22:48:10+00:00</published> <updated>2008-03-26T22:48:10+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  34. 34. <?xml version=quot;1.0quot;?> <message xmlns=quot;jabber:clientquot; from=quot;twitter@twitter.comquot; type=quot;chatquot; id=quot;tag:twitter.com:952601quot; to=quot;aizat.faiz@gmail.comquot;> <body>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</body> <entry xmlns=quot;http://www.w3.org/2005/Atomquot;> <source> <title>Twitter / rajaseelan</title> <link href=quot;http://twitter.com/rajaseelanquot;/> <link href=quot;http://twitter.com/statuses/user_timeline/rajaseelan.atomquot; rel=quot;selfquot; type=quot;application/atom+xmlquot;/> <author> <name>rajaseelan</name> </author> <icon>http://s3.amazonaws.com/twitter_production/profile_images/36242282/raja- profile_normal.png</icon> </source> <title>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</title> <summary>rajaseelan: wow .. jigdo me this batman: Im still downloading Fedora 9 Beta, since yesterday 0630 :P</summary> <link href=quot;http://twitter.com/rajaseelan/statuses/777649976quot; rel=quot;alternatequot; type=quot;text/htmlquot;/> <id>tag:twitter.com,2008-03-26T22:48:10+00:00:/statuses/777649976</id> <published>2008-03-26T22:48:10+00:00</published> <updated>2008-03-26T22:48:10+00:00</updated> </entry> </message> http://flickr.com/photos/mikeleary83/1729114228/
  35. 35. Hpricot A Fast, Enjoyable HTML Parser for Ruby http://code.whytheluckystiff.net/hpricot/ http://flickr.com/photos/mikeleary83/1729114228/
  36. 36. i hpricot http://flickr.com/photos/mikeleary83/1729114228/
  37. 37. I can use the serialized Tweets in the spec now File: ./spec/client_spec.rb http://flickr.com/photos/mikeleary83/1729114228/
  38. 38. Flesh out my Bot File: ./spec/client_spec.rb File: ./lib/client.rb http://flickr.com/photos/mikeleary83/1729114228/
  39. 39. Build your own bot Army! http://flickr.com/photos/dystopos/8921528/
  40. 40. http://flickr.com/photos/dystopos/8921528/
  41. 41. any other ideas? http://flickr.com/photos/genewolf/147722495/
  42. 42. kthxbai aizat.faiz@gmail.com http://creativecommons.org/licenses/by/3.0/ http://flickr.com/photos/warmnfuzzy/466382466/

×