Compare commits

...
Author SHA1 Message Date
Muhsin Keloth 18a929985b feat: add the support for stickers 2023-12-01 12:46:43 +05:30
+18 -1
View File
@@ -42,8 +42,23 @@ class Line::IncomingMessageService
end end
def attach_files(message) def attach_files(message)
return unless message_type_non_text?(message['type']) return unless message_type_non_text?(message['type']) || message['type'] == 'sticker'
if message['type'] == 'sticker'
attachment_file = Down.download(
"https://stickershop.line-scdn.net/stickershop/v1/sticker/#{message[:stickerId]}/iphone/sticker.png"
)
@message.attachments.new(
account_id: @message.account_id,
file_type: 'image',
file: {
io: attachment_file,
filename: "sticker-#{message['stickerId']}.png",
content_type: attachment_file.content_type
}
)
else
response = inbox.channel.client.get_message_content(message['id']) response = inbox.channel.client.get_message_content(message['id'])
file_name = "media-#{message['id']}.#{response.content_type.split('/')[1]}" file_name = "media-#{message['id']}.#{response.content_type.split('/')[1]}"
@@ -61,6 +76,8 @@ class Line::IncomingMessageService
content_type: response.content_type content_type: response.content_type
} }
) )
end
@message.save! @message.save!
end end