pengrad / java-telegram-bot-api

Telegram Bot API for Java
https://core.telegram.org/bots
Apache License 2.0
1.81k stars 373 forks source link

Links are no longer showed up #292

Closed Nopalin closed 2 years ago

Nopalin commented 2 years ago

I am using MarkdownV2 for showing links, with the format: description text but now i was doing some tests and the link just dont appear but the description text. I also switched to html parse mode using a tag, description text but it only shows description text too. I looked fo the changelog and nothing about the links just premium features. In tests i ran at first days of may this links works well. Any body knows if there is any change i has to made? i am using com.github.pengrad:java-telegram-bot-api:5.7.0.

imagen

The code i am using is (it is call from different classes, i put here all together):

StringBuilder sb = new StringBuilder();
sb.append("Cliente: " + RegexUtils.escapeBot(task.getClient()));
//...
sb.append("\n");
sb.append("[Confirmar Descarga de Transporte por el Cliente](http://localhost:8080/link)");
Notification notification = Notification.from("TITLE", sb.toString());

sb = new StringBuilder();
sb.append(String.format("*%s*\r\n", RegexUtils.escapeBot(notification.title)));
sb.append(notification.body);//not escaped here
request = new SendMessage(chatId, sb.toString()).parseMode(ParseMode.MarkdownV2);

bot.execute(request, new Callback<SendMessage, SendResponse>() {
    @Override public void onResponse(SendMessage request, SendResponse response) {
        if(response.isOk()) {
            logger.debug("Telegram message sent: " + response.message());
        } else {
            logger.error("Telegram message failed: " + response.description());
        }
    }

    @Override public void onFailure(SendMessage request, IOException e) {
        logger.error("Telegram message failed: " + e.getMessage());
    }
});
pengrad commented 2 years ago

Only localhost doesn't work, just use any real hostname (or IP address) and it will be fine.