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 17, 2015
1 parent fd55221 commit 8bf4239
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/lita/adapters/vkontakte.rb
Expand Up @@ -81,16 +81,17 @@ def update(a)
method(HANDLERS[code]).call(*data) if HANDLERS[code]
end

def get_message(_msg_id, _flags, # rubocop:disable Metrics/ParameterLists
from_id, _timestamp, subject,
text, _attachments
)
def get_message(_msg_id, flags, # rubocop:disable Metrics/ParameterLists
from_id, _timestamp, subject, text, _attachments)
is_private = subject.start_with?(' ')
is_own = flags & 2 != 0

user = User.new(from_id)
source = Source.new(user: user, room: subject)
message = Message.new(robot, text, source)

return if is_own

message.command! if is_private
robot.receive(message)
end
Expand Down

0 comments on commit 8bf4239

Please sign in to comment.