lib/slack/smart-bot/comm/respond.rb in slack-smart-bot-1.11.0 vs lib/slack/smart-bot/comm/respond.rb in slack-smart-bot-1.12.0
- old
+ new
@@ -47,17 +47,23 @@
txt = msg
else
txt = ""
msg.split("\n").each do |m|
if (m + txt).size > max_chars_per_message
- msgs << txt.chars.each_slice(max_chars_per_message).map(&:join) unless txt == ""
- txt = ""
+ unless txt == ""
+ txt[0] = '.' if txt.match?(/\A\s\s\s/) #first line of message in slack don't show spaces at the begining so we force it by changing first char
+ t = txt.chars.each_slice(max_chars_per_message).map(&:join)
+ msgs << t
+ txt = ""
+ end
end
txt += (m + "\n")
+ txt[0] = '.' if txt.match?(/\A\s\s\s/) #first line of message in slack don't show spaces at the begining so we force it by changing first char
end
end
msgs << txt
msgs.flatten!
+ msgs.delete_if{|e| e.match?(/\A\s*\z/)}
if dest.nil?
if config[:simulate]
open("#{config.path}/buffer_complete.log", "a") { |f|
f.puts "|#{@channel_id}|#{config[:nick_id]}|#{config[:nick]}|#{txt_on_thread}#{msg}~~~"
}