Created
October 20, 2009 11:25
-
-
Save macks/214190 to your computer and use it in GitHub Desktop.
Add followings (or friends) command to Termtter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
module Termtter::Client | |
register_command( | |
:name => :friends, | |
:aliases => [:followings], | |
:help => ['friends,followings', 'Show followings'], | |
:exec_proc => lambda {|arg| | |
user_name = arg.strip.sub(/^@/, '') | |
user_name = config.user_name if user_name.empty? | |
friends = [] | |
page = 0 | |
begin | |
friends += tmp = Termtter::API.twitter.friends(user_name, :page => (page += 1)) | |
end until tmp.empty? | |
friends.map!(&:screen_name) | |
public_storage[:users] += friends | |
puts friends.join(' ') | |
} | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment