цель: сделать так, чтобы бот отвечал при нажатии кнопки (всмысле при нажатии кнопки отсылаестся текст, и надо чтоб бот его читал), но не получается, ибо вылазит такая ошибка (помогите решить):
2022-09-11 23:04:18,058 (__init__.py:986 MainThread) ERROR - TeleBot: "Threaded polling exception: A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized"
2022-09-11 23:04:18,072 (__init__.py:988 MainThread) ERROR - TeleBot: "Exception traceback:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/__init__.py", line 976, in __threaded_polling
polling_thread.raise_exceptions()
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/util.py", line 116, in raise_exceptions
raise self.exception_info
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/util.py", line 98, in run
task(*args, **kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/__init__.py", line 601, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1),
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/__init__.py", line 575, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout, allowed_updates, long_polling_timeout)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/apihelper.py", line 333, in get_updates
return _make_request(token, method_url, params=payload)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/apihelper.py", line 161, in _make_request
json_result = _check_result(method_name, result)
File "/data/user/0/ru.iiec.pydroid3/files/arm-linux-androideabi/lib/python3.9/site-packages/telebot/apihelper.py", line 188, in _check_result
raise ApiTelegramException(method_name, result, result_json)
telebot.apihelper.ApiTelegramException: A request to the Telegram API was unsuccessful. Error code: 401. Description: Unauthorized
""
код:
import telebot
from telebot import *
bot = telebot.TeleBot('токен')
@bot.message_handler(commands=['start'])
def start(message):
markup=types.ReplyKeyboardMarkup(resize_keyboard=True)
item1=types.KeyboardButton("Факт")
markup.add(item1)
bot.send_message(m.chat.id, 'Нажми на кнопку ниже для получения факта', reply_markup=markup)
@bot.message_handler(content_types=["text"])
def handle_text(message):
if message.text.strip() == 'Факт':
bot.send_message(m.message.chat.id, 'Факт')
bot.polling()