K
K
kotovjohn2019-04-06 18:29:34
API
kotovjohn, 2019-04-06 18:29:34

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

and the bot token is visible, how can I hide it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
h0w4rd, 2019-04-06
@h0w4rd

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

The decision in the forehead, but I think what you need.
I don't think I need to explain the logic :)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question