Skip to content

Instantly share code, notes, and snippets.

@ericfode
Created November 29, 2012 23:36
Show Gist options
  • Save ericfode/4172669 to your computer and use it in GitHub Desktop.
Save ericfode/4172669 to your computer and use it in GitHub Desktop.
Sentinel::Command.new(/incidents/, "Lists all of the incidents that Sentinel knows about") do |matches, message|
opts = {
service_id: Sentinel::DB[:room_services]
.join(:rooms, :id => :room_id)
.where(rooms__room_id: message.room_id)
.select(:service_id)
}
records = Sentinel::DB[:incidents].where(opts).order(created_at)
loop records do |record|
message.say Yajil::Encoder.encode(record)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment