Module | FacebookWall |
In: |
facebook_bot/wall.rb
|
Handles functionality related to posting on walls.
Post on a wall. You pass it a friend (via the get_friends method) and a message, which is a simple ol’ string.
fb.wall_post fb.get_friends.find{|x| x.name=='Mark Zuckerberg'}, 'I <3 Facebook' fb.wall_post fb.get_friends.random, 'I hate Facebook, and you as well!'
# File facebook_bot/wall.rb, line 7 7: def wall_post friend, message 8: connect_to_friend friend 9: id_info = get_ids_from_url "/profile.php?id=#{friend.id}", ['post_form_id','id','user'] 10: 11: req = @http.post2('/ajax/wallpost_ajax.php', "to=#{id_info['id']}&from=#{id_info['user']}&text=#{message}&post_form_id=#{id_info['post_form_id']}", @opts[:headers]) 12: 13: #proper response is a JSON reply starting with wp: ('wallpost' I imagine) 14: if req.body.include?('wp:') 15: puts "Wrote on #{friend.name}'s wall with: #{message}" 16: else 17: log req 18: end 19: end