R
R
Raizel90292020-01-09 06:32:46
Documentation
Raizel9029, 2020-01-09 06:32:46

How to make the bot send a text file?

keyboard = telebot.types.ReplyKeyboardMarkup(True,False)
keyboard.row('Hello')
keyboard.row('What information do you have?')
@bot.message_handler(commands=['start'])
def start_message(message ):
bot.send_message(message.chat.id, 'Hi , you texted me /start ', reply_markup=keyboard)
if message.text.lower() == 'hello':
bot.send_message(message.chat .id, 'Hello user')
elif message.text.lower() == 'what information do you have?':
bot.send_message(message.chat.id, 'Guide.docx')
bot.polling(none_stop = True )

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-01-09
@Raizel9029

The code in the question must be tagged!
Here's the file sending function for you, fasten it

def send_file(message):
    doc = open('C:/Гайд.docx', 'rb')
    bot.send_document(message.chat.id, doc)
    bot.send_document(message.chat.id, "FILEID")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question