@bot.messagehandler(func=lambda message: message.text in ['Буду', 'Не буду']) def…
- User
@bot.message_handler(func=lambda message: message.text in ['Буду', 'Не буду']) def record_vote(message): user_id = message.from_user.id if user_id in allowed_user_ids: # проверяем, есть ли пользовател в allowed_user_ids option = message.text voting_results[user_id] = option bot.send_message(message.chat.id, text='Your answer is recorded. Click the button "Return to the main menu"') else: bot.send_message(message.chat.id, text='Sorry, you are not allowed to vote.') описать
- Assistant
@bot.message_handler(func=lambda message: message.text in ['Буду', 'Не буду']) def record_vote(message): user_id = message.from_user.id if user_id in allowed_user_ids: # проверяем, есть ли пользовател в allowed_user_ids option = message.text voting_results[user_id] = option bot.send_message(message.chat.id, text='Ваш ответ записан. Нажмите кнопку "Вернуться в главное меню"') else: bot.send_message(message.chat.id, text='Извините, вы не можете голосовать.')
- User
@bot.message_handler(func=lambda message: message.text in ['Буду', 'Не буду']) def record_vote(message): user_id = message.from_user.id if user_id in allowed_user_ids: # проверяем, есть ли пользовател в allowed_user_ids option = message.text voting_results[user_id] = option bot.send_message(message.chat.id, text='Your answer is recorded. Click the button "Return to the main menu"') else: bot.send_message(message.chat.id, text='Sorry, you are not allowed to vote.') описать код, что происходит
- Assistant
@bot.message_handler(func=lambda message: message.text in ['Буду', 'Не буду']) def record_vote(message): user_id = message.from_user.id if user_id in allowed_user_ids: # проверяем, есть ли пользовател в allowed_user_ids option = message.text voting_results[user_id] = option bot.send_message(message.chat.id, text='Your answer is recorded. Click the button "Return to the main menu"') else: bot.send_message(message.chat.id, text='Sorry, you are not allowed to vote.')