lib/slack/smart-bot/treat_message.rb in slack-smart-bot-1.11.0 vs lib/slack/smart-bot/treat_message.rb in slack-smart-bot-1.12.0
- old
+ new
@@ -72,10 +72,16 @@
data.text = "ruby"
end
if !dest.nil? and config.on_master_bot and !data.text.nil? and data.text.match(/^ping from (.+)\s*$/) and data.user == config[:nick_id]
@pings << $1
end
+ if config.on_master_bot and @vacations_check != Date.today
+ @vacations_check = Date.today
+ t = Thread.new do
+ check_vacations(only_first_day: true)
+ end
+ end
typem = :dont_treat
if data.nil? or data.user.nil? or data.user.to_s==''
user_info = nil
@users = get_users() if @users.empty?
else
@@ -184,11 +190,11 @@
typem = :on_pub
end
end
end
load "#{config.path}/rules/general_commands.rb" if File.exist?("#{config.path}/rules/general_commands.rb") and @datetime_general_commands != File.mtime("#{config.path}/rules/general_commands.rb")
-
+ eval(File.new(config.path + config.rules_file).read) if !defined?(rules) and File.exist?(config.path+config.rules_file) and !config.rules_file.empty?
unless typem == :dont_treat or user_info.nil?
if (Time.now - @last_activity_check) > 60 * 30 #every 30 minutes
@last_activity_check = Time.now
@listening.each do |k,v|
v.each do |kk, vv|
@@ -347,9 +353,13 @@
if File.exist?("#{config.path}/shortcuts/shortcuts_global.yaml")
@shortcuts_global = YAML.load(File.read("#{config.path}/shortcuts/shortcuts_global.yaml"))
end
end
end
+ end
+ unless data.nil? or data.channel.nil? or data.channel.empty?
+ @announcements_activity_after[data.channel] ||= 0
+ @announcements_activity_after[data.channel] += 1
end
rescue Exception => stack
@logger.fatal stack
end
end