I try to send .pdf file like this:
await bot.sendDocument(chatId, fs.readFileSync(outputFilePath), {}, {
filename: outputFileName,
contentType: 'application/pdf',
})
But if the filename includes at least one of these characters "§¤&`£€'", all such characters will be filtered out.
Moreover, these characters are valid for the name of the file itself.
Researching the problem, I came to the conclusion that I need to use 'percent-encoding', but how can I use this with 'sendDocument' method?
Try:
const caption = { caption: "caption" ?? path.basename(outputFilePath) };
const file = { filename: path.basename(outputFilePath), source: await fs.createStream(outputFilePath)};
await bot.telegram.sendDocument(chatId, file, caption);