lib/slack/smart-bot/commands/general/bye_bot.rb in slack-smart-bot-1.14.2 vs lib/slack/smart-bot/commands/general/bye_bot.rb in slack-smart-bot-1.15.0
- old
+ new
@@ -1,19 +1,23 @@
class SlackSmartBot
- def bye_bot(dest, from, display_name)
+ def bye_bot(dest, user, display_name)
+ user_name = user.name
+ team_id = user.team_id
+ team_id_user = team_id + "_" + user_name
+
if @status == :on
save_stats(__method__)
bye = ["Bye", "Bæ", "Good Bye", "Adiós", "Ciao", "Bless", "Bless bless", "Adeu"].sample
respond "#{bye} #{display_name}", dest
- if @listening.key?(from)
+ if @listening.key?(team_id_user)
if Thread.current[:on_thread]
- @listening[from].delete(Thread.current[:thread_ts])
+ @listening[team_id_user].delete(Thread.current[:thread_ts])
else
- @listening[from].delete(dest)
+ @listening[team_id_user].delete(dest)
end
- @listening.delete(from) if @listening[from].empty?
+ @listening.delete(team_id_user) if @listening[team_id_user].empty?
end
end
end
end