conditional reply_prefix for replies

Reply prefix is now only added if the recipient's screen_name isn't
already in the tweet text.
This commit is contained in:
Stawberri 2014-12-11 20:13:53 -08:00
parent 0a915b0a30
commit e6cefa0890

View file

@ -379,7 +379,8 @@ module Ebooks
end
log "Replying to @#{ev.user.screen_name} with: #{meta.reply_prefix + text}"
tweet = twitter.update(meta.reply_prefix + text, opts.merge({in_reply_to_status_id: ev.id}))
text = meta.reply_prefix + text unless text.match /@#{Regexp.escape ev.user.screen_name}/i
tweet = twitter.update(text, opts.merge(in_reply_to_status_id: ev.id))
conversation(tweet).add(tweet)
tweet
else