Answer the question
In order to leave comments, you need to log in
How to make a subscription check in a telegram bot channel?
I check like this
@bot.message_handler(commands=['start'])
def start(message):
user_id = message.chat.id
my_channel_id = -1001337625079
statuss = ['creator', 'administrator', 'member']
for i in statuss:
if i == bot.get_chat_member(chat_id=my_channel_id, user_id=message.from_user.id).status:
bot.send_sticker(message.chat.id, "CAACAgIAAxkBAAEBAlVfAc_5RxAVtkCserEzRwiwmh0UAwACPAAD-7g6BAwMRWBCpy3SGgQ")
break
else:
bot.send_message(message.chat.id, "Подпишись на канал {} для продолжения".format(set_channel))
2020-07-07 19:22:16,630 (__init__.py:448 MainThread) ERROR - TeleBot: "A reques
to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request
Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: chat not found"}']"
Answer the question
In order to leave comments, you need to log in
Maybe a stupid question, but are you sure that the bot is added to the channel?
Duplicated from comments. Another option came to mind, if suddenly someone comes in with a similar problem: make sure that the channel ID is indicated with a minus.
What can be wrong?
chat not found
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question