Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
Telegram Bot sendDocument problem with filename

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?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!