Class: Lita::Handlers::RoomFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/lita/handlers/room_finder.rb

Class Method Summary collapse

Class Method Details

.for(rooms, response, redis) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/lita/handlers/room_finder.rb', line 4

def self.for(rooms, response, redis)
  sender = response.user.mention_name
  room = response.message.source.room_object
  if rooms.has_key?(sender)
    name = rooms[sender]
    RoomQueue.new(name, redis)
  elsif room
    name = self.get_room_name(room)
    RoomQueue.new(name, redis)
  end
end

.get_room_name(room) ⇒ Object

KLUDGE: The following is a hack as the current room_object is incorrect. (lita-slack issue #44)



17
18
19
# File 'lib/lita/handlers/room_finder.rb', line 17

def self.get_room_name(room)
  Lita::Room.find_by_id(room.id).name
end