Skip to content

Instantly share code, notes, and snippets.

@inky
Created December 17, 2014 00:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inky/9037320ae82624b01004 to your computer and use it in GitHub Desktop.
Save inky/9037320ae82624b01004 to your computer and use it in GitHub Desktop.
Unfollow everyone. (for twitter_ebooks v2.x)
bot.scheduler.every '1h', :first_in => '1s' do
bot.log "Start unfollowing"
bot.twitter.friend_ids.each do |friend_id|
bot.log "Will unfollow ##{friend_id}"
begin
bot.twitter.unfollow(user_id=friend_id)
rescue Twitter::Error::TooManyRequests => error
bot.log "Rate limit exceeded; will stop unfollowing for now"
return
rescue Exception => error
bot.log "Error while unfollowing: #{error}"
end
sleep 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment