From 265915daf6811d405f1cf3258e9d59499e618f2f Mon Sep 17 00:00:00 2001 From: Timo Schulz Date: Fri, 20 May 2016 18:39:06 +0200 Subject: [PATCH] bring chatId of SendMessage back to String instead of Long --- .../telegrambots/api/methods/send/SendMessage.java | 8 ++++---- .../telegrambots/bots/TelegramLongPollingBot.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java index 29948c0c..722b8f2a 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java @@ -29,7 +29,7 @@ public class SendMessage extends BotApiMethod { private static final String DISABLENOTIFICATION_FIELD = "disable_notification"; private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYMARKUP_FIELD = "reply_markup"; - private long chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) + private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String text; ///< Text of the message to be sent private String parseMode; ///< Optional. Send Markdown, if you want Telegram apps to show bold, italic and URL text in your bot's message. private Boolean disableWebPagePreview; ///< Optional. Disables link previews for links in this message @@ -45,11 +45,11 @@ public class SendMessage extends BotApiMethod { super(); } - public long getChatId() { + public String getChatId() { return chatId; } - public SendMessage setChatId(long chatId) { + public SendMessage setChatId(String chatId) { this.chatId = chatId; return this; } @@ -168,7 +168,7 @@ public class SendMessage extends BotApiMethod { public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeStartObject(); gen.writeStringField(METHOD_FIELD, PATH); - gen.writeStringField(CHATID_FIELD, Long.toHexString(chatId)); + gen.writeStringField(CHATID_FIELD, chatId); gen.writeStringField(TEXT_FIELD, text); if (parseMode != null) { diff --git a/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java b/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java index d0750dc4..5fae139c 100644 --- a/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java +++ b/src/main/java/org/telegram/telegrambots/bots/TelegramLongPollingBot.java @@ -34,7 +34,7 @@ public abstract class TelegramLongPollingBot extends AbsSender implements ITeleg if (message.isCommand()) { if (!commandRegistry.executeCommand(message)) { SendMessage sendMessage = new SendMessage(); - sendMessage.setChatId(message.getChatId()); + sendMessage.setChatId(message.getChatId().toString()); sendMessage.setText("The command you provided is not registered for this bot"); try { sendMessage(sendMessage);