poll answer does not work, that is, it is not even called, @bot.poll_answer_handler() , I think I tried everything, everything I was looking for is not there, it seems to me that this is some kind of bug already in my system, here is the code
`import telebot
API_TOKEN = “My token)”
bot = telebot.TeleBot(API_TOKEN)
@bot.poll_answer_handler()
def hadle_poll_answer(poll):
print(“Work!”)
print(poll)
@bot.message_handler(commands=[“poll”])
def start(message):
bot.send_poll(message.chat.id, ‘chose’, [‘a’, ‘b’], is_anonymous = False)
@bot.message_handler(commands=[“stop”])
def stop_bot(message):
bot.send_message(message.chat.id, “bye-bye”)
bot.stop_polling()
bot.polling()`
I tried to put a lambda function, but it doesn’t work, maybe you need some kind of bot.poll_handler, or bot.poll_answer_handler, I don’t know , example I found
`# This is an example file to create quiz polls
import telebot
API_TOKEN = “<api_token>”
bot = telebot.TeleBot(API_TOKEN)
@bot.message_handler(commands=[“poll”])
def create_poll(message):
bot.send_message(message.chat.id, “English Article Test”)
answer_options = [“a”, “an”, “the”, “-“]
bot.send_poll(
chat_id=message.chat.id,
question="We are going to '' park.",
options=answer_options,
type="quiz",
correct_option_id=2,
is_anonymous=False,
)
@bot.poll_answer_handler()
def handle_poll(poll):
# This handler can be used to log User answers and to send next poll
pass
bot.infinity_polling()`
Oleg Gladyn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.