电报机器人文本中的文本可以用作 Html 属性吗?
Can text in telegram bot's text works as Html attribute?
if (update.getMessage().getText().equalsIgnoreCase("/register")) {
try {
SendMessage sendMessage = new SendMessage();
sendMessage.setChatId(update.getMessage().getChatId().toString());
sendMessage.setReplyToMessageId(update.getMessage().getMessageId());
sendMessage.setText("Press <a href=\"https://sso.***.com/account/register\">" +
"HERE</a> to register");
execute(sendMessage);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
我正在尝试将 Html 按钮添加到 SendMessage.setText
,但这不起作用。
我是不是哪里做错了?
你的问题一点都不清楚。但我认为你可以添加:
sendMessage.enableHtml(true);
你可以查看Tabnine
if (update.getMessage().getText().equalsIgnoreCase("/register")) {
try {
SendMessage sendMessage = new SendMessage();
sendMessage.setChatId(update.getMessage().getChatId().toString());
sendMessage.setReplyToMessageId(update.getMessage().getMessageId());
sendMessage.setText("Press <a href=\"https://sso.***.com/account/register\">" +
"HERE</a> to register");
execute(sendMessage);
} catch (TelegramApiException e) {
e.printStackTrace();
}
}
我正在尝试将 Html 按钮添加到 SendMessage.setText
,但这不起作用。
我是不是哪里做错了?
你的问题一点都不清楚。但我认为你可以添加:
sendMessage.enableHtml(true);
你可以查看Tabnine