Permalink
Browse files

Error message for retweet protected user, ご主人様.

  • Loading branch information...
1 parent dc6d78f commit f70b6049d795e7b7752faeea307f8bd73da2f74a @jimmyxu jimmyxu committed Jun 16, 2011
Showing with 11 additions and 4 deletions.
  1. +11 −4 commands/timeline.rb
View
@@ -6,11 +6,18 @@ module TimelineCommands
id = params[1]
tweet = user.fetch_tweet(id)
- TwiMeido.current_user.rest_api_client.statuses.retweet!(:id => tweet.id)
+ begin
+ TwiMeido.current_user.rest_api_client.statuses.retweet!(:id => tweet.id)
+ response = "Successfully retweeted tweet #{id_info(tweet, true)}, ご主人様."
+ rescue Grackle::TwitterError => error
+ if error.status == 403
+ response = "The user is protected, ご主人様."
+ else
+ raise
+ end
+ end
- <<-MESSAGE
-Successfully retweeted tweet #{id_info(tweet, true)}, ご主人様.
- MESSAGE
+ response
end
define_command :retweet_with_comment, /\Art\s+(\d+|[a-z]+)(?:\s+(.*))?\Z/im do |user, message, params|

0 comments on commit f70b604

Please sign in to comment.