Код: Выделить всё
// file = "application/pdf;base64,JVBERi0xLjMN...DAwMT=="
private String sendFileToClient(String clientExtId, String file) {
String fileLink;
byte[] data = DatatypeConverter.parseBase64Binary(file);
SendDocument sendDocument = new SendDocument(clientExtId, data);
try {
SendResponse execute = telegramBot.execute(sendDocument);
Document document = execute.message().document();
final String documentId = document.fileId();
fileLink = getFileLink(documentId);
return fileLink;
} catch (Exception e) {
....
}
}
public String getFileLink(String fileId) {
GetFile getFile = new GetFile(fileId);
GetFileResponse fileResponse = telegramBot.execute(getFile);
File file = fileResponse.file();
log.info("getRelativeFilePath filePath : {}", file.filePath()); // documents/file_203.txt ????
return telegramBot.getFullFilePath(file);
}
когда я отправляю фотографию, возвращаю — photos/file_202. jpg
Какая проблема? Пожалуйста, помогите)
UP: compile('com.github.pengrad:java-telegram-bot-api:X.X.X')
Подробнее здесь: https://stackoverflow.com/questions/611 ... cument-pdf
Мобильная версия