I am try to build a telegram bot using python with python-telegram-bot Package and its working with text commands now i try to send a document to user
my code like
def start(update, context): return update.message.download(open('cv.pdf', 'rb'))
but it show a error like return update.message.download(open('cv.pdf', 'rb')) AttributeError: 'Message' object has no attribute 'download'
Then how to send a document file to user any way ?
Advertisement
Answer
There is no download attribute for the message object, but the bot object has a send_document attribute so to successfully send a document.
doc_file = open('cv.pdf', 'rb') chat_id=update.effective_chat.id return context.bot.send_document(chat_id, doc_file)