lib/chatterbot/retweet.rb in chatterbot-0.7.1 vs lib/chatterbot/retweet.rb in chatterbot-0.9.0
- old
+ new
@@ -2,16 +2,22 @@
# routines for retweet
module Retweet
# simple wrapper for retweeting a message
- def retweet(id)
- return if require_login == false
+ # @param [id] id A tweet or the ID of a tweet. if not specified,
+ # tries to use the current tweet if available
+ def retweet(id=@current_tweet)
+ return if require_login == false || id.nil?
+ id = id_from_tweet(id)
+ #:nocov:
if debug_mode?
debug "I'm in debug mode, otherwise I would retweet with tweet id: #{id}"
- else
- client.retweet id
+ return
end
+ #:nocov:
+
+ client.retweet id
end
end
end