Error when editing message
Closed this issue · 1 comments
I use this code to edit message for example:
Message sent = ApiBuilder.api(telegramBotApi) .sendMessage("Answer") .toChatId(message.getChat().getId()) .asReplyToMessage(message.getMessageId()) .execute(); ApiBuilder.api(telegramBotApi) .editMessage() .forMessageId(sent.getMessageId()) .fromChatId(sent.getChat().getId()) .withNewText("Hello") .execute();
I get this error after that.
Message gets updated but exception will be thrown:
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: {"ok":true,"result":{"message_id":274,"from":{"id":341462001,"first_name":"telecombined","username":"telecombinedbot"},"chat":{"id":244331903,"first_name":"Amirhossein","last_name":"Matini","username":"matiniamirhossein","type":"private"},"date":1494009104,"text":"Hello"}} ; line: 1, column: 21] (through reference chain: io.fouad.jtb.core.beans.TelegramResult["result"]) at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:216) at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:873) at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:61) at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11) at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:490) at com.fasterxml.jackson.databind.deser.impl.FieldProperty.deserializeAndSet(FieldProperty.java:101) at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:260) at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:125) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3789) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2798) at io.fouad.jtb.core.utils.JsonUtils.toJavaObject(JsonUtils.java:51) at io.fouad.jtb.core.JTelegramBot.editMessageText(JTelegramBot.java:884) at io.fouad.jtb.core.builders.ApiBuilder$EditingMessageWithNewText.execute(ApiBuilder.java:2360) at Main$1.onMessageReceived(Main.java:37) at io.fouad.jtb.core.JTelegramBot.onUpdateReceived(JTelegramBot.java:205) at io.fouad.jtb.core.JTelegramBot$2.run(JTelegramBot.java:172) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748)
This issue should be solved on the master branch on my fork.