Skip to content

Instantly share code, notes, and snippets.

@nas
Created April 18, 2011 15:04
Show Gist options
  • Save nas/925520 to your computer and use it in GitHub Desktop.
Save nas/925520 to your computer and use it in GitHub Desktop.
A basic, console twitter status update script
#!/usr/local/bin/ruby
require 'rubygems'
require 'highline/import'
require 'twitter'
user = ask("Enter your twitter username:") {|q| q.echo = 'x'}
passwd = ask("Enter your twitter password:") {|q| q.echo = 'x'}
http_auth = Twitter::HTTPAuth.new user, passwd
client = Twitter::Base.new(http_auth)
puts 'connected to twitter'
exit = 'n'
while exit == 'n' || exit == 'no'
puts "Update status:"
message = gets.chomp
client.update message
puts "Twitter status updated successfully"
puts 'Do you want to exit? [Yn]'
exit = gets.chomp.downcase
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment