Skip to content

Commit

Permalink
don't execute own messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Braiden Vasco committed Jun 20, 2015
1 parent 3040682 commit 78db803
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/lita/adapters/gitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def get_message(text, from_id, room_id)
source = Source.new(user: user, room: room_id)
message = Message.new(robot, text, source)

return if from_id == @user_id

message.command!
robot.receive(message)
end
Expand All @@ -112,7 +114,9 @@ def send_message(_target, text) # rubocop:disable AbcSize, MethodLength
request.add_field('Accept', 'application/json')
request.add_field('Authorization', "Bearer #{config.token}")
request.body = { 'text' => text }.to_json
http.request(request)
response = http.request(request)

@user_id = JSON.parse(response.body)['fromUser']['id']
end
end
end
Expand Down

0 comments on commit 78db803

Please sign in to comment.