Почему telebot выдаёт ошибку "telebot.apihelper.ApiTelegramException: user not found"?
import telebot
from telebot import types
token='токен'
bot=telebot.TeleBot(token)
@bot.message_handler(commands=['start'])
def start_message(message):
markup = types.InlineKeyboardMarkup()
button = types.InlineKeyboardButton('Тест канал', url='канал')
markup.add(button)
bot.send_message(message.chat.id, 'Привет, {} подпишись прежде чем продолжить!'.format(message.chat.first_name),reply_markup=markup)
@bot.message_handler(commands=['check_subscription'])
def check_subscription(message):
channel_id = "айди канала"
# Получаем информацию о пользователе в канале
member_info = bot.get_chat_member(channel_id, message.chat.id)
# Проверяем статус подписки пользователя
if member_info.status == 'member' or member_info.status == 'administrator' or member_info.status == 'creator':
bot.reply_to(message, "Вы подписаны на канал")
else:
bot.reply_to(message, "Вы не подписаны на канал")
bot.infinity_polling()
Вот ошибка:
telebot.apihelper.ApiTelegramException:
A request to the Telegram API was unsuccessful.
Error code: 400. Description: Bad Request: user not found