From f362f1ab2b16cb6a10865702e124c50bbf479263 Mon Sep 17 00:00:00 2001 From: Mispy <^_^@mispy.me> Date: Sat, 19 Apr 2014 22:13:07 -0700 Subject: [PATCH] Fix off-by-one error in mentionless calculation --- lib/twitter_ebooks/bot.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/twitter_ebooks/bot.rb b/lib/twitter_ebooks/bot.rb index 1f940ed..6a69689 100644 --- a/lib/twitter_ebooks/bot.rb +++ b/lib/twitter_ebooks/bot.rb @@ -103,7 +103,7 @@ module Ebooks mless = ev[:text] begin ev.attrs[:entities][:user_mentions].reverse.each do |entity| - mless = mless[0...entity[:indices][0]] + mless[entity[:indices][1]...-1] + mless = mless[0...entity[:indices][0]] + mless[entity[:indices][1]+1..-1] end rescue Exception p ev.attrs[:entities][:user_mentions] @@ -136,7 +136,6 @@ module Ebooks # Applies configurable @reply_delay range def reply(ev, text, opts={}) opts = opts.clone - delay = @reply_delay.to_a.sample if ev.is_a? Twitter::DirectMessage log "Sending DM to @#{ev[:sender][:screen_name]}: #{text}"