This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 27f2405 CAMEL-13226: Add sendSticker option (#3453) 27f2405 is described below commit 27f24052b4f80db6c431ab101c080833e58a3339 Author: Miguel Caetano Serra <serramigu...@gmail.com> AuthorDate: Mon Dec 30 05:52:31 2019 +0000 CAMEL-13226: Add sendSticker option (#3453) --- .../src/main/docs/telegram-component.adoc | 1 + .../telegram/model/IncomingMaskPosition.java | 82 +++++++++++++ .../component/telegram/model/IncomingMessage.java | 11 ++ .../component/telegram/model/IncomingSticker.java | 128 +++++++++++++++++++++ .../telegram/model/OutgoingStickerMessage.java | 120 +++++++++++++++++++ .../service/TelegramServiceRestBotAPIAdapter.java | 18 +++ .../telegram/TelegramConsumerMediaStickerTest.java | 94 +++++++++++++++ .../telegram/integration/TelegramServiceTest.java | 30 ++++- .../component/telegram/util/TelegramTestUtil.java | 2 + .../src/test/resources/attachments/sample.webp | Bin 0 -> 5298 bytes .../resources/messages/updates-media-sticker.json | 44 +++++++ 11 files changed, 529 insertions(+), 1 deletion(-) diff --git a/components/camel-telegram/src/main/docs/telegram-component.adoc b/components/camel-telegram/src/main/docs/telegram-component.adoc index 1f93c08..b03a054 100644 --- a/components/camel-telegram/src/main/docs/telegram-component.adoc +++ b/components/camel-telegram/src/main/docs/telegram-component.adoc @@ -226,6 +226,7 @@ The following message bodies are allowed for a producer endpoint (messages of ty | `OutgoingAudioMessage` | To send a mp3 audio to a chat | `OutgoingVideoMessage` | To send a mp4 video to a chat | `OutgoingDocumentMessage` | To send a file to a chat (any media type) +| `OutgoingStickerMessage` | To send a sticker to a chat (WEBP) | `SendLocationMessage` | To send a location (setSendLocation) | `EditMessageLiveLocationMessage` | To send changes to a live location (editMessageLiveLocation) | `StopMessageLiveLocationMessage` | To stop updating a live location message sent by the bot or via the bot (for inline bots) before live_period expires (stopMessageLiveLocation) diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMaskPosition.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMaskPosition.java new file mode 100644 index 0000000..7ae0f32 --- /dev/null +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMaskPosition.java @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.telegram.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * This object describes the position on faces where a mask should be placed by default. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class IncomingMaskPosition { + + private String point; + + @JsonProperty("x_shift") + private Float xShift; + + @JsonProperty("y_shift") + private Float yShift; + + private Float scale; + + public IncomingMaskPosition() { + } + + public String getPoint() { + return point; + } + + public void setPoint(String point) { + this.point = point; + } + + public Float getxShift() { + return xShift; + } + + public void setxShift(Float xShift) { + this.xShift = xShift; + } + + public Float getyShift() { + return yShift; + } + + public void setyShift(Float yShift) { + this.yShift = yShift; + } + + public Float getScale() { + return scale; + } + + public void setScale(Float scale) { + this.scale = scale; + } + + @Override + public String toString() { + return "IncomingMaskPosition{" + + "point='" + point + '\'' + + ", xShift=" + xShift + + ", yShift=" + yShift + + ", scale=" + scale + + '}'; + } +} diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java index 89a7934..1fa6d7e 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingMessage.java @@ -54,6 +54,8 @@ public class IncomingMessage implements Serializable { private IncomingDocument document; + private IncomingSticker sticker; + @JsonProperty("location") private Location location; @@ -132,6 +134,14 @@ public class IncomingMessage implements Serializable { this.document = document; } + public IncomingSticker getSticker() { + return sticker; + } + + public void setSticker(IncomingSticker sticker) { + this.sticker = sticker; + } + public Location getLocation() { return location; } @@ -152,6 +162,7 @@ public class IncomingMessage implements Serializable { sb.append(", video=").append(video); sb.append(", audio=").append(audio); sb.append(", document=").append(document); + sb.append(", sticker=").append(sticker); sb.append(", location=").append(location); sb.append('}'); return sb.toString(); diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingSticker.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingSticker.java new file mode 100644 index 0000000..7262a3b --- /dev/null +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/IncomingSticker.java @@ -0,0 +1,128 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.telegram.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Contains information about a sticker. + */ +@JsonIgnoreProperties(ignoreUnknown = true) +public class IncomingSticker { + + @JsonProperty("file_id") + private String fileId; + + private Integer width; + + private Integer height; + + @JsonProperty("is_animated") + private Boolean isAnimated; + + private IncomingPhotoSize thumb; + + private String emoji; + + @JsonProperty("set_name") + private String setName; + + @JsonProperty("mask_position") + private IncomingMaskPosition maskPosition; + + public IncomingSticker() { + } + + public String getFileId() { + return fileId; + } + + public void setFileId(String fileId) { + this.fileId = fileId; + } + + public Integer getWidth() { + return width; + } + + public void setWidth(Integer width) { + this.width = width; + } + + public Integer getHeight() { + return height; + } + + public void setHeight(Integer height) { + this.height = height; + } + + public Boolean getAnimated() { + return isAnimated; + } + + public void setAnimated(Boolean animated) { + isAnimated = animated; + } + + public IncomingPhotoSize getThumb() { + return thumb; + } + + public void setThumb(IncomingPhotoSize thumb) { + this.thumb = thumb; + } + + public String getEmoji() { + return emoji; + } + + public void setEmoji(String emoji) { + this.emoji = emoji; + } + + public String getSetName() { + return setName; + } + + public void setSetName(String setName) { + this.setName = setName; + } + + public IncomingMaskPosition getMaskPosition() { + return maskPosition; + } + + public void setMaskPosition(IncomingMaskPosition maskPosition) { + this.maskPosition = maskPosition; + } + + @Override + public String toString() { + return "IncomingSticker{" + + "fileId='" + fileId + '\'' + + ", width=" + width + + ", height=" + height + + ", isAnimated=" + isAnimated + + ", thumb=" + thumb + + ", emoji='" + emoji + '\'' + + ", setName='" + setName + '\'' + + ", maskPosition=" + maskPosition + + '}'; + } +} diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingStickerMessage.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingStickerMessage.java new file mode 100644 index 0000000..9bc6c53 --- /dev/null +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/model/OutgoingStickerMessage.java @@ -0,0 +1,120 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.telegram.model; + +import java.util.Arrays; +import java.util.Objects; + +/** + * An outgoing sticker message. + */ +public final class OutgoingStickerMessage extends OutgoingMessage { + + private static final long serialVersionUID = 5118405983382009364L; + + private String sticker; + + private byte[] stickerImage; + + private String filenameWithExtension; + + private OutgoingStickerMessage(String sticker, byte[] stickerImage, String filenameWithExtension, + String chatId, Boolean disableNotification, Long replyToMessageId) { + this.sticker = sticker; + this.stickerImage = stickerImage; + this.filenameWithExtension = filenameWithExtension; + this.chatId = chatId; + this.disableNotification = disableNotification; + this.replyToMessageId = replyToMessageId; + } + + /** + * Creates {@link OutgoingStickerMessage} based on a given webp image. + * + * @param image the image + * @param filenameWithExtension the name of the file to send. Example: file.webp + * @param chatId Unique identifier for the target chat or username of the target channel + * @param disableNotification Sends the message silently. Users will receive a notification with no sound. + * @param replyToMessageId If the message is a reply, ID of the original message + * @return Sticker message. + */ + public static OutgoingStickerMessage createWithImage( + byte[] image, String filenameWithExtension, + String chatId, Boolean disableNotification, Long replyToMessageId + ) { + Objects.requireNonNull(image); + Objects.requireNonNull(filenameWithExtension); + return new OutgoingStickerMessage( + null, image, filenameWithExtension, chatId, disableNotification, replyToMessageId); + } + + /** + * Creates {@link OutgoingStickerMessage} based on a HTTP URL as a String for Telegram to get a .webp file from + * the Internet. + * + * @param url image URL + * @param chatId Unique identifier for the target chat or username of the target channel + * @param disableNotification Sends the message silently. Users will receive a notification with no sound. + * @param replyToMessageId If the message is a reply, ID of the original message + * @return Sticker message. + */ + public static OutgoingStickerMessage createWithUrl( + String url, String chatId, Boolean disableNotification, Long replyToMessageId + ) { + Objects.requireNonNull(url); + return createWithFileId(url, chatId, disableNotification, replyToMessageId); + } + + /** + * Creates {@link OutgoingStickerMessage} based on a file_id to send a file that exists on the Telegram servers. + * + * @param fileId file_id as {@link String} to send a file that exists on the Telegram servers + * @param chatId Unique identifier for the target chat or username of the target channel + * @param disableNotification Sends the message silently. Users will receive a notification with no sound. + * @param replyToMessageId If the message is a reply, ID of the original message + * @return Sticker message. + */ + public static OutgoingStickerMessage createWithFileId(String fileId, String chatId, Boolean disableNotification, + Long replyToMessageId) { + Objects.requireNonNull(fileId); + return new OutgoingStickerMessage(fileId, null, null, chatId, disableNotification, replyToMessageId); + } + + public String getSticker() { + return sticker; + } + + public byte[] getStickerImage() { + return stickerImage; + } + + public String getFilenameWithExtension() { + return filenameWithExtension; + } + + @Override + public String toString() { + return "OutgoingStickerMessage{" + + "sticker='" + sticker + '\'' + + ", stickerImage=" + Arrays.toString(stickerImage) + + ", filenameWithExtension='" + filenameWithExtension + '\'' + + ", chatId='" + chatId + '\'' + + ", disableNotification=" + disableNotification + + ", replyToMessageId=" + replyToMessageId + + '}'; + } +} diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/service/TelegramServiceRestBotAPIAdapter.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/service/TelegramServiceRestBotAPIAdapter.java index 560d227..3373c9b 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/service/TelegramServiceRestBotAPIAdapter.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/service/TelegramServiceRestBotAPIAdapter.java @@ -40,6 +40,7 @@ import org.apache.camel.component.telegram.model.OutgoingAudioMessage; import org.apache.camel.component.telegram.model.OutgoingDocumentMessage; import org.apache.camel.component.telegram.model.OutgoingMessage; import org.apache.camel.component.telegram.model.OutgoingPhotoMessage; +import org.apache.camel.component.telegram.model.OutgoingStickerMessage; import org.apache.camel.component.telegram.model.OutgoingTextMessage; import org.apache.camel.component.telegram.model.OutgoingVideoMessage; import org.apache.camel.component.telegram.model.SendLocationMessage; @@ -88,6 +89,7 @@ public class TelegramServiceRestBotAPIAdapter implements TelegramService { m.put(OutgoingAudioMessage.class, new OutgoingAudioMessageHandler(asyncHttpClient, bufferSize, mapper, baseUri)); m.put(OutgoingVideoMessage.class, new OutgoingVideoMessageHandler(asyncHttpClient, bufferSize, mapper, baseUri)); m.put(OutgoingDocumentMessage.class, new OutgoingDocumentMessageHandler(asyncHttpClient, bufferSize, mapper, baseUri)); + m.put(OutgoingStickerMessage.class, new OutgoingStickerMessageHandler(asyncHttpClient, bufferSize, mapper, baseUri)); m.put(SendLocationMessage.class, new OutgoingPlainMessageHandler(asyncHttpClient, bufferSize, mapper, baseUri + "/sendLocation")); m.put(EditMessageLiveLocationMessage.class, @@ -265,6 +267,22 @@ public class TelegramServiceRestBotAPIAdapter implements TelegramService { } + static class OutgoingStickerMessageHandler extends OutgoingMessageHandler<OutgoingStickerMessage> { + public OutgoingStickerMessageHandler(AsyncHttpClient asyncHttpClient, int bufferSize, ObjectMapper mapper, String baseUri) { + super(asyncHttpClient, bufferSize, mapper, baseUri + "/sendSticker", null); + } + + @Override + protected void addBody(RequestBuilder builder, OutgoingStickerMessage message) { + fillCommonMediaParts(builder, message); + if (message.getSticker() != null) { + buildTextPart(builder, "sticker", message.getSticker()); + } else { + buildMediaPart(builder, "sticker", message.getFilenameWithExtension(), message.getStickerImage()); + } + } + } + abstract static class OutgoingMessageHandler<T extends OutgoingMessage> { protected final ObjectMapper mapper; private final AsyncHttpClient asyncHttpClient; diff --git a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerMediaStickerTest.java b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerMediaStickerTest.java new file mode 100644 index 0000000..5e18fca --- /dev/null +++ b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/TelegramConsumerMediaStickerTest.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.component.telegram; + +import org.apache.camel.EndpointInject; +import org.apache.camel.Exchange; +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.component.telegram.model.IncomingMaskPosition; +import org.apache.camel.component.telegram.model.IncomingMessage; +import org.apache.camel.component.telegram.model.IncomingPhotoSize; +import org.apache.camel.component.telegram.model.IncomingSticker; +import org.apache.camel.component.telegram.util.TelegramMockRoutes; +import org.apache.camel.component.telegram.util.TelegramTestSupport; +import org.apache.camel.component.telegram.util.TelegramTestUtil; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +public class TelegramConsumerMediaStickerTest extends TelegramTestSupport { + + @EndpointInject("mock:telegram") + private MockEndpoint endpoint; + + @Test + public void testReceptionOfAMessageWithASticker() throws Exception { + endpoint.expectedMinimumMessageCount(1); + endpoint.assertIsSatisfied(5000); + + Exchange mediaExchange = endpoint.getExchanges().get(0); + IncomingMessage msg = mediaExchange.getIn().getBody(IncomingMessage.class); + + IncomingSticker sticker = msg.getSticker(); + + assertNotNull(sticker); + assertEquals(Integer.valueOf(512), sticker.getHeight()); + assertEquals(Integer.valueOf(512), sticker.getWidth()); + assertEquals("\ud83d\ude28", sticker.getEmoji()); + assertEquals("CAADBAADEQADmDVxAkmg3XnDZam0FgQ", sticker.getFileId()); + assertEquals("GreatMindsColor", sticker.getSetName()); + assertFalse(sticker.getAnimated()); + + IncomingMaskPosition incomingMaskPosition = sticker.getMaskPosition(); + assertEquals("forehead", incomingMaskPosition.getPoint()); + assertEquals(2.0f, incomingMaskPosition.getScale()); + assertEquals(-1.0f, incomingMaskPosition.getxShift()); + assertEquals(1.0f, incomingMaskPosition.getyShift()); + + IncomingPhotoSize thumb = sticker.getThumb(); + assertNotNull(thumb); + + } + + @Override + protected RoutesBuilder[] createRouteBuilders() throws Exception { + return new RoutesBuilder[] { + getMockRoutes(), + new RouteBuilder() { + @Override + public void configure() throws Exception { + from("telegram:bots?authorizationToken=mock-token") + .to("mock:telegram"); + } + }}; + } + + @Override + protected TelegramMockRoutes createMockRoutes() { + return new TelegramMockRoutes(port) + .addEndpoint( + "getUpdates", + "GET", + String.class, + TelegramTestUtil.stringResource("messages/updates-media-sticker.json"), + TelegramTestUtil.stringResource("messages/updates-empty.json")); + } +} diff --git a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java index 0d2e517..f5e3988 100644 --- a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java +++ b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/integration/TelegramServiceTest.java @@ -25,6 +25,7 @@ import org.apache.camel.component.telegram.model.InlineKeyboardButton; import org.apache.camel.component.telegram.model.OutgoingAudioMessage; import org.apache.camel.component.telegram.model.OutgoingDocumentMessage; import org.apache.camel.component.telegram.model.OutgoingPhotoMessage; +import org.apache.camel.component.telegram.model.OutgoingStickerMessage; import org.apache.camel.component.telegram.model.OutgoingTextMessage; import org.apache.camel.component.telegram.model.OutgoingVideoMessage; import org.apache.camel.component.telegram.model.ReplyKeyboardMarkup; @@ -241,10 +242,37 @@ public class TelegramServiceTest extends TelegramTestSupport { OutgoingDocumentMessage msg = new OutgoingDocumentMessage(); msg.setDocument(document); msg.setChatId(chatId); - msg.setFilenameWithExtension("file.png"); + msg.setFilenameWithExtension("file.txt"); msg.setCaption("A document"); template.requestBody(String.format("telegram://bots?chatId=%s", chatId), msg); } + @Test + public void testSendStickerViaImage() throws IOException { + byte[] document = TelegramTestUtil.createSampleImage("WEBP"); + + OutgoingStickerMessage msg = OutgoingStickerMessage.createWithImage(document, "file.webp", chatId, null, null); + + template.requestBody(String.format("telegram://bots?chatId=%s", chatId), msg); + } + + @Test + public void testSendStickerViaFileId() { + String fileId = "CAADBAADEQADmDVxAkmg3XnDZam0FgQ"; + + OutgoingStickerMessage msg = OutgoingStickerMessage.createWithFileId(fileId, chatId, null, null); + + template.requestBody(String.format("telegram://bots?chatId=%s", chatId), msg); + } + + @Test + public void testSendStickerViaUrl() { + String imageUri = "https://www.gstatic.com/webp/gallery/1.sm.webp?dcb_=0.7185987052045011"; + + OutgoingStickerMessage msg = OutgoingStickerMessage.createWithUrl(imageUri, chatId, null, null); + + template.requestBody(String.format("telegram://bots?chatId=%s", chatId), msg); + } + } diff --git a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/util/TelegramTestUtil.java b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/util/TelegramTestUtil.java index b5630da..3c08005 100644 --- a/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/util/TelegramTestUtil.java +++ b/components/camel-telegram/src/test/java/org/apache/camel/component/telegram/util/TelegramTestUtil.java @@ -49,6 +49,8 @@ public final class TelegramTestUtil { img = readBytesFromStream(TelegramTestUtil.class.getResourceAsStream("/attachments/sample.png")); } else if (imageIOType.equalsIgnoreCase("jpg")) { img = readBytesFromStream(TelegramTestUtil.class.getResourceAsStream("/attachments/sample.jpg")); + } else if ("webp".equalsIgnoreCase(imageIOType)) { + img = readBytesFromStream(TelegramTestUtil.class.getResourceAsStream("/attachments/sample.webp")); } else { throw new IllegalArgumentException("Unknown format " + imageIOType); } diff --git a/components/camel-telegram/src/test/resources/attachments/sample.webp b/components/camel-telegram/src/test/resources/attachments/sample.webp new file mode 100644 index 0000000..2cadf19 Binary files /dev/null and b/components/camel-telegram/src/test/resources/attachments/sample.webp differ diff --git a/components/camel-telegram/src/test/resources/messages/updates-media-sticker.json b/components/camel-telegram/src/test/resources/messages/updates-media-sticker.json new file mode 100644 index 0000000..63e318e --- /dev/null +++ b/components/camel-telegram/src/test/resources/messages/updates-media-sticker.json @@ -0,0 +1,44 @@ +{ + "ok": true, + "result": [ + { + "update_id": 525704899, + "message": { + "message_id": 180, + "from": { + "id": 1585844777, + "first_name": "John", + "last_name": "Doe" + }, + "chat": { + "id": 158584478, + "first_name": "John", + "last_name": "Doe", + "type": "private" + }, + "date": 1463479642, + "sticker": { + "file_id":"CAADBAADEQADmDVxAkmg3XnDZam0FgQ", + "file_size":42112, + "width":512, + "height":512, + "emoji":"\ud83d\ude28", + "set_name":"GreatMindsColor", + "is_animated":false, + "mask_position": { + "point": "forehead", + "x_shift": "-1.0 ", + "y_shift": "1.0", + "scale": "2.0" + }, + "thumb": { + "file_id":"AAQCAAPfCAACCLcZAnLSRFdZiNzlpSg5DwAEAQAHbQADXxgAAhYE", + "file_size":6316, + "width":128, + "height":128 + } + } + } + } + ] +}