mirror of
https://github.com/thewesker/twitter_ebooks.git
synced 2025-12-20 04:11:08 -05:00
Keep people in convo as long as they replied once
This commit is contained in:
@@ -40,8 +40,8 @@ module Ebooks
|
|||||||
# Figure out whether to keep this user in the reply prefix
|
# Figure out whether to keep this user in the reply prefix
|
||||||
# We want to avoid spamming non-participating users
|
# We want to avoid spamming non-participating users
|
||||||
def can_include?(username)
|
def can_include?(username)
|
||||||
@tweets.length <= 6 ||
|
@tweets.length <= 4 ||
|
||||||
!@tweets[-6..-1].select { |t| t.user.screen_name.downcase == username.downcase }.empty?
|
!@tweets.select { |t| t.user.screen_name.downcase == username.downcase }.empty?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -134,11 +134,7 @@ describe Ebooks::Bot do
|
|||||||
|
|
||||||
Timecop.travel(Time.now + 60)
|
Timecop.travel(Time.now + 60)
|
||||||
bot.receive_event(mock_tweet("spammer", "@test_ebooks @m1sp 3"))
|
bot.receive_event(mock_tweet("spammer", "@test_ebooks @m1sp 3"))
|
||||||
expect_tweet(bot, "@spammer @m1sp echo: 3")
|
expect_tweet(bot, "@spammer echo: 3")
|
||||||
|
|
||||||
Timecop.travel(Time.now + 60)
|
|
||||||
bot.receive_event(mock_tweet("spammer", "@test_ebooks @m1sp 4"))
|
|
||||||
expect_tweet(bot, "@spammer echo: 4")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user