slack-smart-bot 1.9.1 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +184 -16
- data/lib/slack/smart-bot/comm/ask.rb +55 -49
- data/lib/slack/smart-bot/comm/delete.rb +13 -0
- data/lib/slack/smart-bot/comm/dont_understand.rb +3 -3
- data/lib/slack/smart-bot/comm/event_hello.rb +8 -4
- data/lib/slack/smart-bot/comm/get_channel_members.rb +13 -4
- data/lib/slack/smart-bot/comm/get_channels.rb +31 -16
- data/lib/slack/smart-bot/comm/get_presence.rb +20 -0
- data/lib/slack/smart-bot/comm/get_user_info.rb +12 -8
- data/lib/slack/smart-bot/comm/get_users.rb +24 -0
- data/lib/slack/smart-bot/comm/react.rb +19 -2
- data/lib/slack/smart-bot/comm/respond.rb +224 -53
- data/lib/slack/smart-bot/comm/respond_direct.rb +2 -3
- data/lib/slack/smart-bot/comm/respond_thread.rb +5 -0
- data/lib/slack/smart-bot/comm/send_file.rb +38 -34
- data/lib/slack/smart-bot/comm/send_msg_channel.rb +27 -22
- data/lib/slack/smart-bot/comm/send_msg_user.rb +59 -33
- data/lib/slack/smart-bot/comm/unreact.rb +22 -18
- data/lib/slack/smart-bot/comm.rb +4 -0
- data/lib/slack/smart-bot/commands/general/add_admin.rb +51 -0
- data/lib/slack/smart-bot/commands/general/add_announcement.rb +32 -0
- data/lib/slack/smart-bot/commands/general/add_team.rb +80 -0
- data/lib/slack/smart-bot/commands/general/allow_access.rb +67 -0
- data/lib/slack/smart-bot/commands/general/bot_help.rb +69 -33
- data/lib/slack/smart-bot/commands/general/bye_bot.rb +0 -7
- data/lib/slack/smart-bot/commands/general/delete_announcement.rb +34 -0
- data/lib/slack/smart-bot/commands/general/delete_share.rb +34 -0
- data/lib/slack/smart-bot/commands/general/delete_team.rb +34 -0
- data/lib/slack/smart-bot/commands/general/deny_access.rb +36 -0
- data/lib/slack/smart-bot/commands/general/hi_bot.rb +16 -11
- data/lib/slack/smart-bot/commands/general/ping_team.rb +100 -0
- data/lib/slack/smart-bot/commands/general/poster.rb +116 -0
- data/lib/slack/smart-bot/commands/general/remove_admin.rb +58 -0
- data/lib/slack/smart-bot/commands/general/see_access.rb +24 -0
- data/lib/slack/smart-bot/commands/general/see_admins.rb +33 -0
- data/lib/slack/smart-bot/commands/general/see_announcements.rb +115 -0
- data/lib/slack/smart-bot/commands/general/see_command_ids.rb +29 -0
- data/lib/slack/smart-bot/commands/general/see_favorite_commands.rb +53 -0
- data/lib/slack/smart-bot/commands/general/see_shares.rb +41 -0
- data/lib/slack/smart-bot/commands/general/see_statuses.rb +91 -0
- data/lib/slack/smart-bot/commands/general/see_teams.rb +252 -0
- data/lib/slack/smart-bot/commands/general/share_messages.rb +58 -0
- data/lib/slack/smart-bot/commands/general/update_team.rb +109 -0
- data/lib/slack/smart-bot/commands/general_bot_commands.rb +504 -0
- data/lib/slack/smart-bot/commands/on_bot/add_shortcut.rb +4 -6
- data/lib/slack/smart-bot/commands/on_bot/admin/add_routine.rb +45 -14
- data/lib/slack/smart-bot/commands/on_bot/admin/extend_rules.rb +4 -1
- data/lib/slack/smart-bot/commands/on_bot/admin/pause_bot.rb +6 -3
- data/lib/slack/smart-bot/commands/on_bot/admin/pause_routine.rb +3 -1
- data/lib/slack/smart-bot/commands/on_bot/admin/remove_routine.rb +4 -4
- data/lib/slack/smart-bot/commands/on_bot/admin/run_routine.rb +8 -2
- data/lib/slack/smart-bot/commands/on_bot/admin/see_result_routine.rb +33 -0
- data/lib/slack/smart-bot/commands/on_bot/admin/see_routines.rb +13 -10
- data/lib/slack/smart-bot/commands/on_bot/admin/start_bot.rb +6 -3
- data/lib/slack/smart-bot/commands/on_bot/admin/start_routine.rb +3 -1
- data/lib/slack/smart-bot/commands/on_bot/admin/stop_using_rules_on.rb +4 -1
- data/lib/slack/smart-bot/commands/on_bot/admin_master/delete_message.rb +25 -0
- data/lib/slack/smart-bot/commands/on_bot/admin_master/get_bot_logs.rb +1 -0
- data/lib/slack/smart-bot/commands/on_bot/admin_master/react_to.rb +34 -0
- data/lib/slack/smart-bot/commands/on_bot/admin_master/send_message.rb +37 -0
- data/lib/slack/smart-bot/commands/on_bot/delete_repl.rb +4 -5
- data/lib/slack/smart-bot/commands/on_bot/delete_shortcut.rb +7 -8
- data/lib/slack/smart-bot/commands/on_bot/general/bot_stats.rb +400 -0
- data/lib/slack/smart-bot/commands/{general → on_bot/general}/bot_status.rb +3 -4
- data/lib/slack/smart-bot/commands/on_bot/general/leaderboard.rb +201 -0
- data/lib/slack/smart-bot/commands/{general → on_bot/general}/stop_using_rules.rb +12 -6
- data/lib/slack/smart-bot/commands/on_bot/general/suggest_command.rb +36 -0
- data/lib/slack/smart-bot/commands/{general → on_bot/general}/use_rules.rb +13 -11
- data/lib/slack/smart-bot/commands/{general → on_bot/general}/whats_new.rb +2 -1
- data/lib/slack/smart-bot/commands/on_bot/get_repl.rb +4 -5
- data/lib/slack/smart-bot/commands/on_bot/repl.rb +76 -21
- data/lib/slack/smart-bot/commands/on_bot/ruby_code.rb +3 -4
- data/lib/slack/smart-bot/commands/on_bot/run_repl.rb +15 -7
- data/lib/slack/smart-bot/commands/on_bot/see_repls.rb +5 -6
- data/lib/slack/smart-bot/commands/on_bot/see_shortcuts.rb +5 -6
- data/lib/slack/smart-bot/commands/on_extended/bot_rules.rb +45 -12
- data/lib/slack/smart-bot/commands/on_master/admin/kill_bot_on_channel.rb +7 -3
- data/lib/slack/smart-bot/commands/on_master/admin_master/exit_bot.rb +4 -1
- data/lib/slack/smart-bot/commands/on_master/admin_master/notify_message.rb +3 -1
- data/lib/slack/smart-bot/commands/on_master/admin_master/publish_announcements.rb +33 -0
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_general_message.rb +39 -0
- data/lib/slack/smart-bot/commands/on_master/admin_master/set_maintenance.rb +10 -1
- data/lib/slack/smart-bot/commands/on_master/create_bot.rb +28 -14
- data/lib/slack/smart-bot/commands/on_master/where_smartbot.rb +41 -0
- data/lib/slack/smart-bot/commands.rb +36 -5
- data/lib/slack/smart-bot/listen.rb +31 -33
- data/lib/slack/smart-bot/process.rb +234 -73
- data/lib/slack/smart-bot/process_first.rb +119 -38
- data/lib/slack/smart-bot/treat_message.rb +310 -237
- data/lib/slack/smart-bot/utils/build_help.rb +2 -2
- data/lib/slack/smart-bot/utils/create_routine_thread.rb +81 -46
- data/lib/slack/smart-bot/utils/get_access_channels.rb +13 -0
- data/lib/slack/smart-bot/utils/get_admins_channels.rb +13 -0
- data/lib/slack/smart-bot/utils/get_bots_created.rb +28 -8
- data/lib/slack/smart-bot/utils/get_channels_name_and_id.rb +7 -2
- data/lib/slack/smart-bot/utils/get_command_ids.rb +84 -0
- data/lib/slack/smart-bot/utils/get_help.rb +79 -73
- data/lib/slack/smart-bot/utils/get_repls.rb +22 -2
- data/lib/slack/smart-bot/utils/get_routines.rb +22 -2
- data/lib/slack/smart-bot/utils/get_shares.rb +12 -0
- data/lib/slack/smart-bot/utils/get_teams.rb +22 -0
- data/lib/slack/smart-bot/utils/has_access.rb +28 -0
- data/lib/slack/smart-bot/utils/is_admin.rb +27 -0
- data/lib/slack/smart-bot/utils/save_stats.rb +46 -41
- data/lib/slack/smart-bot/utils/save_status.rb +67 -0
- data/lib/slack/smart-bot/utils/update_access_channels.rb +8 -0
- data/lib/slack/smart-bot/utils/update_admins_channels.rb +8 -0
- data/lib/slack/smart-bot/utils/update_bots_file.rb +28 -7
- data/lib/slack/smart-bot/utils/update_repls.rb +7 -4
- data/lib/slack/smart-bot/utils/update_routines.rb +9 -3
- data/lib/slack/smart-bot/utils/update_shortcuts_file.rb +13 -6
- data/lib/slack/smart-bot/utils/update_teams.rb +16 -0
- data/lib/slack/smart-bot/utils.rb +11 -0
- data/lib/slack-smart-bot.rb +72 -12
- data/lib/slack-smart-bot_general_commands.rb +61 -0
- data/lib/slack-smart-bot_general_rules.rb +5 -2
- data/lib/slack-smart-bot_rules.rb +43 -17
- data/whats_new.txt +20 -15
- metadata +76 -9
- data/lib/slack/smart-bot/commands/general/bot_stats.rb +0 -313
@@ -1,30 +1,51 @@
|
|
1
1
|
class SlackSmartBot
|
2
|
-
def process_first(user, text, dest, dchannel, typem, files, ts, thread_ts, routine)
|
2
|
+
def process_first(user, text, dest, dchannel, typem, files, ts, thread_ts, routine, routine_name, routine_type, command_orig)
|
3
3
|
nick = user.name
|
4
4
|
rules_file = ""
|
5
5
|
text.gsub!(/^!!/,'^') # to treat it just as ^
|
6
|
+
shared = []
|
7
|
+
if @shares.key?(@channels_name[dest]) and (ts.to_s!='' or config.simulate) and (user.id!=config.nick_id or (user.id == config.nick_id and !text.match?(/\A\*?Shares from channel/)))
|
8
|
+
@shares[@channels_name[dest]].each do |row|
|
9
|
+
if row[:user_deleted]==''
|
10
|
+
if ((row[:type] == 'text' and text.include?(row[:condition][1..-2])) or (row[:type]=='regexp' and text.match?(/#{row[:condition][1..-2]}/im))) and !shared.include?(row[:to_channel])
|
11
|
+
if config.simulate
|
12
|
+
link = text
|
13
|
+
else
|
14
|
+
link = client.web_client.chat_getPermalink(channel: dest, message_ts: ts).permalink
|
15
|
+
end
|
16
|
+
respond "*<#{link}|Shared> by <@#{row[:user_created]}> from <##{dest}>* using share id #{row[:share_id]}", row[:to_channel]
|
17
|
+
shared << row[:to_channel]
|
18
|
+
sleep 0.2
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
6
24
|
if typem == :on_call
|
7
25
|
rules_file = config.rules_file
|
8
26
|
elsif dest[0] == "C" or dest[0] == "G" # on a channel or private channel
|
9
27
|
rules_file = config.rules_file
|
10
28
|
|
11
|
-
if @rules_imported.key?(user.
|
12
|
-
unless @bots_created.key?(@rules_imported[user.
|
29
|
+
if @rules_imported.key?(user.name) and @rules_imported[user.name].key?(dchannel)
|
30
|
+
unless @bots_created.key?(@rules_imported[user.name][dchannel])
|
13
31
|
get_bots_created()
|
14
32
|
end
|
15
|
-
if @bots_created.key?(@rules_imported[user.
|
16
|
-
rules_file = @bots_created[@rules_imported[user.
|
33
|
+
if @bots_created.key?(@rules_imported[user.name][dchannel])
|
34
|
+
rules_file = @bots_created[@rules_imported[user.name][dchannel]][:rules_file]
|
17
35
|
end
|
18
36
|
end
|
19
|
-
elsif dest[0] == "D" and @rules_imported.key?(user.
|
20
|
-
unless @bots_created.key?(@rules_imported[user.
|
37
|
+
elsif dest[0] == "D" and @rules_imported.key?(user.name) and @rules_imported[user.name].key?(user.name) #direct message
|
38
|
+
unless @bots_created.key?(@rules_imported[user.name][user.name])
|
21
39
|
get_bots_created()
|
22
40
|
end
|
23
|
-
if @bots_created.key?(@rules_imported[user.
|
24
|
-
rules_file = @bots_created[@rules_imported[user.
|
41
|
+
if @bots_created.key?(@rules_imported[user.name][user.name])
|
42
|
+
rules_file = @bots_created[@rules_imported[user.name][user.name]][:rules_file]
|
43
|
+
end
|
44
|
+
elsif dest[0] == 'D' and (!@rules_imported.key?(user.name) or ( @rules_imported.key?(user.name) and !@rules_imported[user.name].key?(user.name)))
|
45
|
+
if File.exist?("#{config.path}/rules/general_rules.rb")
|
46
|
+
rules_file = "/rules/general_rules.rb"
|
25
47
|
end
|
26
48
|
end
|
27
|
-
|
28
49
|
if nick == config[:nick] #if message is coming from the bot
|
29
50
|
begin
|
30
51
|
case text
|
@@ -160,6 +181,9 @@ class SlackSmartBot
|
|
160
181
|
begin
|
161
182
|
t = Thread.new do
|
162
183
|
begin
|
184
|
+
processed = false
|
185
|
+
processed_rules = false
|
186
|
+
|
163
187
|
Thread.current[:dest] = dest
|
164
188
|
Thread.current[:user] = user
|
165
189
|
Thread.current[:command] = command
|
@@ -169,30 +193,37 @@ class SlackSmartBot
|
|
169
193
|
Thread.current[:ts] = ts
|
170
194
|
Thread.current[:thread_ts] = thread_ts
|
171
195
|
Thread.current[:routine] = routine
|
196
|
+
Thread.current[:routine_name] = routine_name
|
197
|
+
Thread.current[:routine_type] = routine_type
|
198
|
+
Thread.current[:dchannel] = dchannel
|
199
|
+
Thread.current[:command_orig] = command_orig
|
172
200
|
if thread_ts.to_s == ''
|
173
201
|
Thread.current[:on_thread] = false
|
174
202
|
Thread.current[:thread_ts] = Thread.current[:ts] # to create the thread if necessary
|
175
203
|
else
|
176
204
|
Thread.current[:on_thread] = true
|
177
205
|
end
|
178
|
-
if (dest[0] == "C") || (dest[0] == "G") and @rules_imported.key?(user.
|
179
|
-
@rules_imported[user.
|
180
|
-
Thread.current[:using_channel] = @rules_imported[user.
|
181
|
-
elsif dest[0] == "D" && @rules_imported.key?(user.
|
182
|
-
@bots_created.key?(@rules_imported[user.
|
183
|
-
Thread.current[:using_channel] = @rules_imported[user.
|
206
|
+
if (dest[0] == "C") || (dest[0] == "G") and @rules_imported.key?(user.name) &&
|
207
|
+
@rules_imported[user.name].key?(dchannel) && @bots_created.key?(@rules_imported[user.name][dchannel])
|
208
|
+
Thread.current[:using_channel] = @rules_imported[user.name][dchannel]
|
209
|
+
elsif dest[0] == "D" && @rules_imported.key?(user.name) && @rules_imported[user.name].key?(user.name) and
|
210
|
+
@bots_created.key?(@rules_imported[user.name][user.name])
|
211
|
+
Thread.current[:using_channel] = @rules_imported[user.name][user.name]
|
184
212
|
else
|
185
213
|
Thread.current[:using_channel] = ''
|
186
214
|
end
|
187
|
-
|
188
|
-
|
215
|
+
if typem == :on_pub or typem == :on_pg
|
216
|
+
processed = false
|
217
|
+
else
|
218
|
+
processed = process(user, command, dest, dchannel, rules_file, typem, files, Thread.current[:thread_ts])
|
219
|
+
end
|
189
220
|
@logger.info "command: #{nick}> #{command}" if processed
|
190
221
|
on_demand = false
|
191
|
-
if command.match(
|
192
|
-
command.match(
|
193
|
-
command.match(
|
194
|
-
command.match(
|
195
|
-
command.match(
|
222
|
+
if command.match(/\A@?(#{config[:nick]}):*\s+(.+)/im) or
|
223
|
+
command.match(/\A()!!(.+)/im) or
|
224
|
+
command.match(/\A()\^(.+)/im) or
|
225
|
+
command.match(/\A()!(.+)/im) or
|
226
|
+
command.match(/\A()<@#{config[:nick_id]}>\s+(.+)/im)
|
196
227
|
command2 = $2
|
197
228
|
Thread.current[:command] = command2
|
198
229
|
if command2.match?(/^()!!(.+)/im) or
|
@@ -202,7 +233,25 @@ class SlackSmartBot
|
|
202
233
|
command = command2
|
203
234
|
on_demand = true
|
204
235
|
end
|
205
|
-
unless config.on_maintenance
|
236
|
+
unless config.on_maintenance or @status != :on
|
237
|
+
if typem == :on_pub or typem == :on_pg or typem == :on_extended
|
238
|
+
if command.match(/\A\s*(#{@salutations.join("|")})\s+(rules|help)\s*(.+)?$/i) or command.match(/\A(#{@salutations.join("|")}),? what can I do/i)
|
239
|
+
$2.to_s.match?(/rules/i) ? specific = true : specific = false
|
240
|
+
help_command = $3
|
241
|
+
if typem == :on_extended and specific
|
242
|
+
bot_rules(dest, help_command, typem, rules_file, user)
|
243
|
+
else
|
244
|
+
bot_help(user, user.name, dest, dchannel, specific, help_command, rules_file)
|
245
|
+
end
|
246
|
+
processed = true
|
247
|
+
end
|
248
|
+
end
|
249
|
+
processed = (processed || general_bot_commands(user, command, dest, files) )
|
250
|
+
processed = (processed || general_commands(user, command, dest, files) ) if defined?(general_commands)
|
251
|
+
@logger.info "command: #{nick}> #{command}" if processed
|
252
|
+
end
|
253
|
+
|
254
|
+
if !config.on_maintenance and !processed and typem != :on_pub and typem != :on_pg
|
206
255
|
if @status == :on and
|
207
256
|
(!answer.empty? or
|
208
257
|
(@repl_sessions.key?(nick) and dest==@repl_sessions[nick][:dest] and
|
@@ -216,9 +265,9 @@ class SlackSmartBot
|
|
216
265
|
#todo: verify this
|
217
266
|
|
218
267
|
if dest[0] == "C" or dest[0] == "G" or (dest[0] == "D" and typem == :on_call)
|
219
|
-
if typem != :on_call and @rules_imported.key?(user.
|
220
|
-
if @bots_created.key?(@rules_imported[user.
|
221
|
-
if @bots_created[@rules_imported[user.
|
268
|
+
if typem != :on_call and @rules_imported.key?(user.name) and @rules_imported[user.name].key?(dchannel)
|
269
|
+
if @bots_created.key?(@rules_imported[user.name][dchannel])
|
270
|
+
if @bots_created[@rules_imported[user.name][dchannel]][:status] != :on
|
222
271
|
respond "The bot on that channel is not :on", dest
|
223
272
|
rules_file = ""
|
224
273
|
end
|
@@ -235,19 +284,19 @@ class SlackSmartBot
|
|
235
284
|
command[0] = "" if command[0] == "!"
|
236
285
|
command.gsub!(/^@\w+:*\s*/, "")
|
237
286
|
if method(:rules).parameters.size == 4
|
238
|
-
rules(user, command, processed, dest)
|
287
|
+
processed_rules = rules(user, command, processed, dest)
|
239
288
|
elsif method(:rules).parameters.size == 5
|
240
|
-
rules(user, command, processed, dest, files)
|
289
|
+
processed_rules = rules(user, command, processed, dest, files)
|
241
290
|
else
|
242
|
-
rules(user, command, processed, dest, files, rules_file)
|
291
|
+
processed_rules = rules(user, command, processed, dest, files, rules_file)
|
243
292
|
end
|
244
293
|
else
|
245
294
|
@logger.warn "It seems like rules method is not defined"
|
246
295
|
end
|
247
296
|
end
|
248
|
-
elsif @rules_imported.key?(user.
|
249
|
-
if @bots_created.key?(@rules_imported[user.
|
250
|
-
if @bots_created[@rules_imported[user.
|
297
|
+
elsif @rules_imported.key?(user.name) and @rules_imported[user.name].key?(user.name)
|
298
|
+
if @bots_created.key?(@rules_imported[user.name][user.name])
|
299
|
+
if @bots_created[@rules_imported[user.name][user.name]][:status] == :on
|
251
300
|
begin
|
252
301
|
eval(File.new(config.path+rules_file).read) if File.exist?(config.path+rules_file) and !['.','..'].include?(config.path + rules_file)
|
253
302
|
rescue Exception => stack
|
@@ -255,7 +304,7 @@ class SlackSmartBot
|
|
255
304
|
@logger.fatal stack
|
256
305
|
end
|
257
306
|
else
|
258
|
-
respond "The bot on <##{@rules_imported[user.
|
307
|
+
respond "The bot on <##{@rules_imported[user.name][user.name]}|#{@bots_created[@rules_imported[user.name][user.name]][:channel_name]}> is not :on", dest
|
259
308
|
rules_file = ""
|
260
309
|
end
|
261
310
|
end
|
@@ -265,16 +314,43 @@ class SlackSmartBot
|
|
265
314
|
command[0] = "" if command[0] == "!"
|
266
315
|
command.gsub!(/^@\w+:*\s*/, "")
|
267
316
|
if method(:rules).parameters.size == 4
|
268
|
-
rules(user, command, processed, dest)
|
317
|
+
processed_rules = rules(user, command, processed, dest)
|
269
318
|
elsif method(:rules).parameters.size == 5
|
270
|
-
rules(user, command, processed, dest, files)
|
319
|
+
processed_rules = rules(user, command, processed, dest, files)
|
271
320
|
else
|
272
|
-
rules(user, command, processed, dest, files, rules_file)
|
321
|
+
processed_rules = rules(user, command, processed, dest, files, rules_file)
|
273
322
|
end
|
274
323
|
else
|
275
324
|
@logger.warn "It seems like rules method is not defined"
|
276
325
|
end
|
277
326
|
end
|
327
|
+
elsif dest[0] == 'D' and
|
328
|
+
(!@rules_imported.key?(user.name) or ( @rules_imported.key?(user.name) and !@rules_imported[user.name].key?(user.name))) and
|
329
|
+
rules_file.include?('general_rules.rb')
|
330
|
+
begin
|
331
|
+
eval(File.new(config.path+rules_file).read) if File.exist?(config.path+rules_file) and !['.','..'].include?(config.path + rules_file)
|
332
|
+
rescue Exception => stack
|
333
|
+
@logger.fatal "ERROR ON imported RULES FILE: #{rules_file}"
|
334
|
+
@logger.fatal stack
|
335
|
+
end
|
336
|
+
|
337
|
+
if defined?(general_rules)
|
338
|
+
command[0] = "" if command[0] == "!"
|
339
|
+
command.gsub!(/^@\w+:*\s*/, "")
|
340
|
+
#todo: check to change processed > processed_rules
|
341
|
+
if method(:general_rules).parameters.size == 4
|
342
|
+
processed = general_rules(user, command, processed, dest)
|
343
|
+
elsif method(:general_rules).parameters.size == 5
|
344
|
+
processed = general_rules(user, command, processed, dest, files)
|
345
|
+
else
|
346
|
+
processed = general_rules(user, command, processed, dest, files, rules_file)
|
347
|
+
end
|
348
|
+
else
|
349
|
+
@logger.warn "It seems like general_rules method is not defined"
|
350
|
+
end
|
351
|
+
unless processed
|
352
|
+
dont_understand('')
|
353
|
+
end
|
278
354
|
else
|
279
355
|
@logger.info "it is a direct message with no rules file selected so no rules file executed."
|
280
356
|
if command.match?(/^\s*bot\s+rules\s*(.*)$/i)
|
@@ -285,6 +361,8 @@ class SlackSmartBot
|
|
285
361
|
end
|
286
362
|
end
|
287
363
|
|
364
|
+
processed = (processed_rules || processed)
|
365
|
+
|
288
366
|
if processed and @listening.key?(nick)
|
289
367
|
if Thread.current[:on_thread] and @listening[nick].key?(Thread.current[:thread_ts])
|
290
368
|
@listening[nick][Thread.current[:thread_ts]] = Time.now
|
@@ -292,9 +370,12 @@ class SlackSmartBot
|
|
292
370
|
@listening[nick][dest] = Time.now
|
293
371
|
end
|
294
372
|
end
|
295
|
-
|
296
373
|
end
|
297
374
|
end
|
375
|
+
|
376
|
+
if processed and config.general_message != '' and !routine
|
377
|
+
respond eval("\"" + config.general_message + "\"")
|
378
|
+
end
|
298
379
|
rescue Exception => stack
|
299
380
|
@logger.fatal stack
|
300
381
|
end
|