Skip to content

send document file #2297

Answered by RememberTheAir
rezakarbasi asked this question in Q&A
Discussion options

You must be logged in to vote

The wiki has a quite detailed chapter about working with files and medias: Working with files and media

In short, to send a file from disk, you have to open it and pass the bytes object to the Bot.send_document method:

with open("some_file.txt", "rb") as f:
  bot.send_document(chat_id, f)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Bibo-Joshi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants