Closed guccilenses closed 5 years ago
@guccilenses here's your problem: sendMsg(null, ...)
just replace null
with message
message
org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 114 at org.telegram.telegrambots.meta.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:170) at org.telegram.telegrambots.meta.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:24) at org.telegram.telegrambots.bots.DefaultAbsSender.sendApiMethod(DefaultAbsSender.java:717) at org.telegram.telegrambots.meta.bots.AbsSender.execute(AbsSender.java:47) at Bot.sendMsg(Bot.java:51) at Bot.onUpdateReceived(Bot.java:38) at java.util.ArrayList.forEach(Unknown Source) at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:305)
doesn't fix my problem
This is another error.
[400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 114
It says that telegram server can't parse your html or markdown message, for example, when you forgot to close the tag. Try to temporary disable markdown or just escape _
, *
and `
symbols:
sendMessage.setText(s.replaceAll("([_*`])", "\\\\$1"));
Was your problem solved @guccilenses ? If yes, please close the issue. Thanks!
Closing due to inactivity
java.lang.NullPointerException at Bot.sendMsg(Bot.java:50) at Bot.onUpdateReceived(Bot.java:41) at java.util.ArrayList.forEach(Unknown Source) at org.telegram.telegrambots.meta.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27) at org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:305)
My Code: `
@Override public void onUpdateReceived(Update update) { Message message = update.getMessage(); if(message != null && message.hasText()) { if(message.getText().equals("/help")) { sendMsg(message, "Список доступных команд:\n /help - список команд\n /info - информация о боте. \n "); } if(message.getText().equals("/random")) { sendMsg(null, "я думаю это " + message.getFrom().toString()); }
` When i'm send /help all works, when /random nothing works.