Skip to content

Instantly share code, notes, and snippets.

@dacort
Created June 14, 2011 17:56
Show Gist options
  • Save dacort/1025451 to your computer and use it in GitHub Desktop.
Save dacort/1025451 to your computer and use it in GitHub Desktop.
Twitter Mass Notification Disable
client = Grackle::Client.new(:auth => {
:type => :oauth,
:consumer_key => CONSUMER_KEY, :consumer_secret => CONSUMER_SECRET,
:token => TOKEN, :token_secret => TOKEN_SECRET
})
users = []
(client.friends.ids?).each_slice(100) do |uids|
users |= (client.users.lookup? :user_id => uids.join(','))
end
sms_uids = users.select{|u| u.notifications}.collect{|u| u.id}
sms_uids.each_slice(100) do |uids|
client.lists.members.create_all!(
:slug => LIST_SLUG,
:owner_screen_name => MY_SCREEN_NAME,
:user_id => uids.join(',')
)
end
sms_uids.each do |uid|
client.notifications.leave! :user_id => uid
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment