org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 5atorg.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:170) atorg.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:24) at org.telegram.telegrambots.bots.DefaultAbsSender.sendApiMethod(DefaultAbsSender.java:690)at org.telegram.telegrambots.bots.AbsSender.execute(AbsSender.java:53)at TBot.sendMsg(TBot.java:79)at TBot.onUpdateReceived(TBot.java:47)at java.util.ArrayList.forEach(ArrayList.java:1257)at org.telegram.telegrambots.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27)atorg.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:311)
Hello! I'm new with telegram bot API. I'm trying to collect information about the members of the group and display it on the command / list.
To store the list of participants I use ArrayList and when print them in cycle.
Part of code:
if(message.getText().equals("/list")){
for(int i=0;i<list.size();i++){
String s = list.get(i).getName();
sendMsg(message, s);
}
sending method:
private void sendMsg(Message message, String s) {
SendMessage sendMessage=new SendMessage();
sendMessage.enableMarkdown(true);
sendMessage.setChatId(message.getChatId().toString());
sendMessage.setReplyToMessageId(message.getMessageId());
sendMessage.setText(s);
try{
execute(sendMessage);
}catch (TelegramApiException e){
e.printStackTrace();
}
}
finaly catch an exception:
org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending message: [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 5
at
org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:170) at
org.telegram.telegrambots.api.methods.send.SendMessage.deserializeResponse(SendMessage.java:24) at org.telegram.telegrambots.bots.DefaultAbsSender.sendApiMethod(DefaultAbsSender.java:690)
at org.telegram.telegrambots.bots.AbsSender.execute(AbsSender.java:53)
at TBot.sendMsg(TBot.java:79)
at TBot.onUpdateReceived(TBot.java:47)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.telegram.telegrambots.generics.LongPollingBot.onUpdatesReceived(LongPollingBot.java:27)
at
org.telegram.telegrambots.updatesreceivers.DefaultBotSession$HandlerThread.run(DefaultBotSession.java:311)