lib/slack/smart-bot/commands/general/add_announcement.rb in slack-smart-bot-1.10.0 vs lib/slack/smart-bot/commands/general/add_announcement.rb in slack-smart-bot-1.11.0
- old
+ new
@@ -6,10 +6,10 @@
if Thread.current[:typem] == :on_call
channel = Thread.current[:dchannel]
else
channel = Thread.current[:dest]
end
- if File.exists?("#{config.path}/announcements/#{channel}.csv") and !@announcements.key?(channel)
+ if File.exist?("#{config.path}/announcements/#{channel}.csv") and !@announcements.key?(channel)
t = CSV.table("#{config.path}/announcements/#{channel}.csv", headers: ['message_id', 'user_deleted', 'user_created', 'date', 'time', 'type', 'message'])
@announcements[channel] = t
num = t[:message_id].max + 1
elsif !@announcements.key?(channel)
File.open("#{config.path}/announcements/#{channel}.csv","w")