Closed BlackRose01 closed 5 years ago
Hello, SendDocument extends PartialBotApiMethod (and not BotApiMethod), so it can not be used as response on processing webhook (and the same restriction is applied in long polling mode for consistency).
So you can use SendDocument command as follow:
@TelegramCommand(value = "/sola", description = "Testmethode")
public void getDocument(User user, DefaultAbsSender absSender) throws FileNotFoundException {
System.out.println("moni");
FileInputStream fis = new FileInputStream(new File(""));
SendDocument sendDocumentRequest = new SendDocument();
sendDocumentRequest.setChatId(user.getId().longValue());
sendDocumentRequest.setDocument("Testdokument", fis);
sendDocumentRequest.setCaption("Test");
absSender.execute(sendDocumentRequest);
}
Hello there,
I want to send documents but i always get the following error.
`@TelegramCommand(value = "/sola", description = "Testmethode") public SendDocument getDocument(User user) throws FileNotFoundException { System.out.println("moni"); FileInputStream fis = new FileInputStream(new File(""));
SendDocument sendDocumentRequest = new SendDocument();
}`
Regardings, BlackRose01