@Andriy426

Почему бот ничего не видает, грузит и все?

import telebot
from telebot import types
 
bot = telebot.TeleBot('5783659449:AAHb6z7iHBFkyq7rV0duPh5ApJR8IAVwxVQ')

first = ['приватная силка на канал']
sec = ['приватная силка на канал']
 
@bot.message_handler(commands=['start'])
def welcome(message):
  
  button1 = types.InlineKeyboardButton(text="Подписаться", url='https://t.me/+ZKrRaZROYk85OTRi')
  button2 = types.InlineKeyboardButton(text="Подписаться", url='https://t.me/+z49sa7QnHrkxMDM6')
  button3 = types.InlineKeyboardButton(text="Готово✅", callback_data='done')
  start_kb = types.InlineKeyboardMarkup(row_width=2)

  start_kb.add(button1)
  start_kb.add(button2)
  start_kb.add(button3)

  bot.send_message(message.chat.id, "Подпишись на канали:", parse_mode='html', reply_markup=start_kb, disable_web_page_preview=True)
 
bot.callback_query_handler(func=lambda call: True)
def callback_inline(call):
    try:
        if call.message:
            if call.data == 'done':
                status = ['creator', 'administrator', 'member']
                for first_chanel in status:
                    if first_chanel == bot.get_chat_member(chat_id=first, user_id=call.from_user.id).status:
                      status1 = ['creator', 'administrator', 'member']
                      for sec_chanel in status1:
                        if sec_chanel == bot.get_chat_member(chat_id=sec, user_id=call.from_user.id).status1:
                          bot.send_message(call.message.chat.id, "Доступ дозволено!")
                          break
                      else:
                        bot.answer_callback_query(callback_query_id=call.id, show_alert=True, text="Немає підписки на другий канал")
                    else:
                      bot.answer_callback_query(callback_query_id=call.id, show_alert=True, text="Немає підписки на перший канал")
            else:
              bot.send_message(call.message.chat.id, "Я не знаю что ответить")

    except Exception as e:
        print(repr(e))
 
bot.polling(none_stop=True)
  • Вопрос задан
  • 100 просмотров
Пригласить эксперта
Ответы на вопрос 1
SoreMix
@SoreMix Куратор тега Python
yellow
bot.callback_query_handler(func=lambda call: True)

Собаки не хватает у декоратора
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы