lib/lita/handlers/totems.rb in lita-totems-0.3.2 vs lib/lita/handlers/totems.rb in lita-totems-0.3.3

- old
+ new

@@ -69,10 +69,11 @@ redis.del("totem/#{totem}/list") redis.srem("totems", totem) owning_user_id = redis.get("totem/#{totem}/owning_user_id") redis.srem("user/#{owning_user_id}/totems", totem) if owning_user_id redis.del("totem/#{totem}/waiting_since") + redis.del("totem/#{totem}/message") response.reply(%{Destroyed totem "#{totem}".}) else response.reply(%{Error: totem "#{totem}" doesn't exist.}) end end @@ -180,11 +181,11 @@ end redis.srem("user/#{past_owning_user_id}/totems", totem) redis.hdel("totem/#{totem}/waiting_since", past_owning_user_id) redis.hdel("totem/#{totem}/message", past_owning_user_id) - robot.send_messages(Lita::Source.new(user: Lita::User.find_by_id(past_owning_user_id)), %{You have been kicked from totem "#{totem}".}) + robot.send_messages(Lita::Source.new(user: Lita::User.find_by_id(past_owning_user_id)), %{You have been kicked from totem "#{totem}" by #{response.user.name}.}) next_user_id = redis.lpop("totem/#{totem}/list") if next_user_id redis.set("totem/#{totem}/owning_user_id", next_user_id) redis.sadd("user/#{next_user_id}/totems", totem) redis.hset("totem/#{totem}/waiting_since", next_user_id, Time.now.to_i) @@ -247,10 +248,10 @@ if next_user_id redis.set("totem/#{totem}/owning_user_id", next_user_id) redis.sadd("user/#{next_user_id}/totems", totem) redis.hset("totem/#{totem}/waiting_since", next_user_id, Time.now.to_i) next_user = Lita::User.find_by_id(next_user_id) - robot.send_messages(Lita::Source.new(user: next_user), %{You are now in possession of totem "#{totem}."}) + robot.send_messages(Lita::Source.new(user: next_user), %{You are now in possession of totem "#{totem}," yielded by #{response.user.name}.}) response.reply "You have yielded the totem to #{next_user.name}." else redis.del("totem/#{totem}/owning_user_id") response.reply %{You have yielded the "#{totem}" totem.} end