3

I was getting started with telegram bots and I was wondering if there's a way to get a BOT to search through the files posted in a channel (and possibly download them, if the user asks for it).

For instance, if a BOT has a command "/search" and the user searches a file using certain keywords, then the BOT should answer with the requested file, if found on the channel, and it should also provide an internal link to download it.

I noticed that the APIs provide a getFile method that maybe could be useful in this case, I just wanted to know if this thing is achievable!

Hope I've made myself clear!

marko988
  • 33
  • 1
  • 5
  • You can send files by file_id. You need to have those data stored somewhere in a database. you could make your bot add the id with the name to a db everytime a file is sent in the group. Then you can search your db for the filename and return the file by id if a match is found – John Apr 01 '19 at 10:11
  • Did you ever find a decent solution for this? Trying to implement similar logic: have a BOT search for uploaded files in a channel and download a specific file (based by name) - I won't have the file_id. Any tips? – john.acb Oct 31 '20 at 22:54

0 Answers0