Archives

Older posts coming eventually.

A simple re-tweet script

I want to be able to tweet as Ellie from my phone, without logging in and out of the web interface. So I made a simple re-tweet script that will let me send direct messages and have them get posted.


#!/usr/bin/env ruby

require 'twitter'
twitter = Twitter::Base.new('USERNAME', 'PASSWORD')

retweeters = ["ivey"]

twitter.direct_messages.each do |message|
  if retweeters.include? message.sender_screen_name
    twitter.update(message.text)
  else
    twitter.d('ivey',"#{message.sender_screen_name}: #{message.text}")
  end
  twitter.destroy_direct_message(message.id)
end

Be sure to change my username to yours (in both places). Run the script via cron how ever often you like.