Answer the question
In order to leave comments, you need to log in
Need to get a link to a file sent to the bot, where the bot token will not be visible?
msg.photo[1].file_id
resulting in a link of the format:
https://api.telegram.org/file/bot<token>/photos/file
Answer the question
In order to leave comments, you need to log in
let url = "https://api.telegram.org/file/bot<token>/photos/file";
let arr = url.split("bot");
let result = arr[0] + "bot<token>/" + arr[1].split("/")[1];
console.log(result); // https://api.telegram.org/file/bot<token>/photos
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question