From 56ac18e2634b0f1451be5c8bb4034c9dd97d6f9c Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Wed, 1 Jun 2016 02:06:35 +0200 Subject: [PATCH] Fix ForwardMessage method --- .../api/methods/ForwardMessage.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java index 14da4fa7..c7254102 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java @@ -19,12 +19,12 @@ import java.io.IOException; public class ForwardMessage extends BotApiMethod { public static final String PATH = "forwardmessage"; - public static final String CHATID_FIELD = "chat_id"; - public static final String FROMCHATID_FIELD = "from_chat_id"; - public static final String MESSAGEID_FIELD = "message_id"; - public static final String DISABLENOTIFICATION_FIELD = "disable_notification"; + private static final String CHATID_FIELD = "chat_id"; + private static final String FROMCHATID_FIELD = "from_chat_id"; + private static final String MESSAGEID_FIELD = "message_id"; + private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private String chatId; ///< Unique identifier for the chat to send the message to (or username for channels) - private Integer fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id + private String fromChatId; ///< Unique identifier for the chat where the original message was sent — User or GroupChat id private Integer messageId; ///< Unique message identifier /** * Optional. Sends the message silently. @@ -47,11 +47,17 @@ public class ForwardMessage extends BotApiMethod { return this; } - public Integer getFromChatId() { + @Deprecated + public ForwardMessage setFromChatId(Integer fromChatId) { + this.fromChatId = fromChatId.toString(); + return this; + } + + public String getFromChatId() { return fromChatId; } - public ForwardMessage setFromChatId(Integer fromChatId) { + public ForwardMessage setFromChatId(String fromChatId) { this.fromChatId = fromChatId; return this; } @@ -82,7 +88,7 @@ public class ForwardMessage extends BotApiMethod { gen.writeStartObject(); gen.writeStringField(METHOD_FIELD, PATH); gen.writeStringField(CHATID_FIELD, chatId); - gen.writeNumberField(FROMCHATID_FIELD, fromChatId); + gen.writeStringField(FROMCHATID_FIELD, fromChatId); gen.writeNumberField(MESSAGEID_FIELD, messageId); if (disableNotification != null) { gen.writeBooleanField(DISABLENOTIFICATION_FIELD, disableNotification);