From 2e57e92c62a10ca158ab502d4b51f13f0d027eab Mon Sep 17 00:00:00 2001 From: Stas Parshin Date: Sun, 10 Dec 2017 15:02:36 +0700 Subject: [PATCH] Added field mask_position to the addStickerToSet method #120 --- .gitignore | 1 + .../com/pengrad/telegrambot/request/AddStickerToSet.java | 5 +++++ .../test/java/com/pengrad/telegrambot/TelegramBotTest.java | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index de0b7ec3..1e8efe6c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.iml .gradle build +out .DS_Store local.properties \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/request/AddStickerToSet.java b/library/src/main/java/com/pengrad/telegrambot/request/AddStickerToSet.java index b6cc7879..fafacfae 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/AddStickerToSet.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/AddStickerToSet.java @@ -1,5 +1,6 @@ package com.pengrad.telegrambot.request; +import com.pengrad.telegrambot.model.MaskPosition; import com.pengrad.telegrambot.response.BaseResponse; /** @@ -14,4 +15,8 @@ public AddStickerToSet(Integer userId, String name, Object pngSticker, String em add("name", name); add("emojis", emojis); } + + public AddStickerToSet maskPosition(MaskPosition maskPosition) { + return add("mask_position", serialize(maskPosition)); + } } diff --git a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java index afcaa353..b10ef089 100644 --- a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java +++ b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java @@ -908,7 +908,8 @@ public void createNewStickerSet() throws IOException { @Test public void addStickerToSet() { BaseResponse response = bot.execute( - new AddStickerToSet(chatId, stickerSet, "BQADAgADuAAD7yupS4eB23UmZhGuAg", "\uD83D\uDE15")); + new AddStickerToSet(chatId, stickerSet, "BQADAgADuAAD7yupS4eB23UmZhGuAg", "\uD83D\uDE15") + .maskPosition(new MaskPosition("eyes", 0f, 0f, 1f))); assertTrue(response.isOk()); }