Skip to content

Commit 8f7251b

Browse files
committed
Add example for unsend
1 parent 47e0eca commit 8f7251b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

examples/kitchensink/app.rb

+19
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ def reply_content(event, messages)
8080
when Line::Bot::Event::VideoPlayComplete
8181
reply_text(event, "[VIDEOPLAYCOMPLETE]\n#{JSON.generate(event['videoPlayComplete'])}")
8282

83+
when Line::Bot::Event::Unsend
84+
handle_unsend(event)
85+
8386
else
8487
reply_text(event, "Unknown event type: #{event}")
8588
end
@@ -616,3 +619,19 @@ def handle_location(event)
616619
longitude: message['longitude']
617620
})
618621
end
622+
623+
def handle_unsend(event)
624+
source = event['source']
625+
id = case source['type']
626+
when 'user'
627+
source['userId']
628+
when 'group'
629+
source['groupId']
630+
when 'room'
631+
source['roomId']
632+
end
633+
client.push_message(id, {
634+
type: 'text',
635+
text: "[UNSEND]\nmessageId: #{event['unsend']['messageId']}"
636+
})
637+
end

0 commit comments

Comments
 (0)