Answer the question
In order to leave comments, you need to log in
How to stop listener in telegram bot?
I have such a problem. I created a handler, in which I put bot.set_update_listener(listener), inside which, under a certain condition, the listener stops. The condition is met, but the listener does not stop and continues. But why? how can i fix this problem? it turns out because the listener is in one handler, then I can't use another one, so I would have to close it
def listener(messages):
for m in messages:
chatid = m.chat.id
print(m.content_type)
print('this is text')
text = m.text
if m.text =='/close':
break
bot.send_message(chatid, text)
bot.set_update_listener(listener)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question