Keep people in convo as long as they replied once

This commit is contained in:
Jaiden Mispy 2014-12-20 07:24:40 +11:00
parent 52d82c99ae
commit 596f41f15f
2 changed files with 3 additions and 7 deletions

View file

@ -40,8 +40,8 @@ module Ebooks
# Figure out whether to keep this user in the reply prefix
# We want to avoid spamming non-participating users
def can_include?(username)
@tweets.length <= 6 ||
!@tweets[-6..-1].select { |t| t.user.screen_name.downcase == username.downcase }.empty?
@tweets.length <= 4 ||
!@tweets.select { |t| t.user.screen_name.downcase == username.downcase }.empty?
end
end

View file

@ -134,11 +134,7 @@ describe Ebooks::Bot do
Timecop.travel(Time.now + 60)
bot.receive_event(mock_tweet("spammer", "@test_ebooks @m1sp 3"))
expect_tweet(bot, "@spammer @m1sp echo: 3")
Timecop.travel(Time.now + 60)
bot.receive_event(mock_tweet("spammer", "@test_ebooks @m1sp 4"))
expect_tweet(bot, "@spammer echo: 4")
expect_tweet(bot, "@spammer echo: 3")
end
end