Бот отправляет один раз файл после повторного нажатия на кнопку бот выдает ошибку в чем проблема?? Вот код
# -*- coding: utf-8 -*-
import sqlite3
import telebot
from telebot import types
from telebot.types import Message
TOKEN = '<TOKEN>'
bot = telebot.TeleBot(TOKEN)
doc = open('D:\Game\учеба\Дело.docx', 'rb')
markup_menu = types.ReplyKeyboardMarkup(resize_keyboard =True, row_width=1)
btn_1 = types.KeyboardButton('1 Lesson')
btn_2 = types.KeyboardButton('2 Lesson')
btn_3 = types.KeyboardButton('3 Lesson')
btn_4 = types.KeyboardButton('4 Lesson')
btn_5 = types.KeyboardButton('5 Lesson')
btn_6 = types.KeyboardButton('6 Lesson')
btn_7 = types.KeyboardButton('7 Lesson')
btn_8 = types.KeyboardButton('8 Lesson')
btn_9 = types.KeyboardButton('9 Lesson')
btn_10 = types.KeyboardButton('10 Lesson')
markup_menu.add(btn_1, btn_2, btn_3, btn_4,btn_5,btn_6,btn_7,btn_8,
btn_9,btn_10)
@bot.message_handler(commands=['start'])
def send_welcome(message):
global userId
userId = message.from_user.id
print(userId)
bot.reply_to(message, "Welcome", reply_markup=markup_menu)
@bot.message_handler(commands=['help'])
def send_help_message(message):
bot.reply_to(message, "Список команд:/HELP|/START|/INFO"
, reply_markup=markup_menu)
@bot.message_handler(commands=['info'])
def send_help_message(message):
bot.reply_to(message, "Это бот Bitlife здесь вы можете получить все
уроки, reply_markup=markup_menu)
@bot.message_handler(func=lambda message: True)
def echo_all(message):
if message.text == "1 Lesson":
out_msg = bot.send_document(message.chat.id, doc)
print(out_msg)
else:
bot.reply_to(message, 'Я незнаю такой команды. Вы можете просмотреть
список команд написав /help')
bot.polling(timeout=1/2)