Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/fbcli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,26 @@ def list_events(past = false)
end
end

desc "Post to a message to a User Group."
long_desc %(
You can post a message to a User Group you are a member as long as
you know the Group ID.
)
arg_name "message"
command :postgroup do |c|
c.flag [:i, :groupid], :desc => 'User Group ID'
c.action do |global_options, options, args|
full_post_id = FBCLI::publish_group options['groupid'], args[0]

group_id, post_id = full_post_id.split '_', 2

puts "Your post to the group is : https://www.facebook.com/groups/#{group_id}/permalink/#{post_id}"
end


end


desc "Show event details"
arg_name "[ids...]"
command :event do |c|
Expand Down Expand Up @@ -490,4 +510,4 @@ def list_events(past = false)
end
end

exit run(ARGV)
exit run(ARGV)
4 changes: 2 additions & 2 deletions lib/fbcli/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module FBCLI
def self.listen_for_auth_code(port, app_id, app_secret)
uri = "https://www.facebook.com/dialog/oauth?client_id=#{app_id}" +
"&redirect_uri=http://localhost:#{port}/" +
"&scope=user_likes,user_friends,user_posts,user_photos,user_videos,user_events,publish_actions"
"&scope=user_likes,user_friends,user_posts,user_photos,user_videos,user_events,publish_actions,user_managed_groups,user_events"

puts "Please open: #{uri}"
puts
Expand Down Expand Up @@ -61,4 +61,4 @@ def self.get_access_token(port, app_id, auth_code, app_secret)

res["access_token"]
end
end
end
11 changes: 10 additions & 1 deletion lib/fbcli/facebook.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,13 @@ def self.publish_video(msg, video_file_or_url, title = nil)

result['id']
end
end

def self.publish_group(id , msg)
result = api_call lambda { |api|
api.put_connections(id, "feed", {:message => msg})
}

result['id']
end

end