lib/slack/smart-bot/commands/general/bye_bot.rb in slack-smart-bot-1.5.1 vs lib/slack/smart-bot/commands/general/bye_bot.rb in slack-smart-bot-1.6.0
- old
+ new
@@ -10,9 +10,17 @@
def bye_bot(dest, from, display_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
- @listening.delete(from)
+
+ if @listening.key?(from)
+ if Thread.current[:on_thread]
+ @listening[from].delete(Thread.current[:thread_ts])
+ else
+ @listening[from].delete(dest)
+ end
+ @listening.delete(from) if @listening[from].empty?
+ end
end
end
end