Open tesserata opened 6 years ago
increase your timeout = 10 to something bigger.
Well, then it just takes longer before IdleTerminate appears. The problem is that no callback is returned after push or the callback handler doesn't react to it (the input would contain the log otherwise)
I think you forgot to put these lines at the end:
while 1:
time.sleep(10)
Without them, the program's main thread will end right away, and the MessageLoop
, which is run as a second thread, will evaporate. You need to keep the program alive for MessageLoop
to keep working.
Oh, I did not specify this in the question; I'm running my code in the IPython notebook for now, so the kernel doesn't die after executing the code and continues to listen. I've tried to add the cycle you mentioned, but it changes nothing.
The thing is that bot reacts to commands with a slash (like, /docs
), but doesn't react to pressing a button in InlineKeyboardMarkup
. So I suppose it has something to do with callback response.
You will need to mention the 'callback_query' parameter in the MessageLoop. I think this should work:
MessageLoop(bot, {'chat': on_chat_message, 'callback_query': on_callback_query}).run_as_thread()
Hello!
I've tried to write a bot that should react to button pressing with some further actions. Part of the code is omitted below, but the problem is that
on_callback_query
method ofDocumentsHandler
is never called. I also tried to put all this just in oneChatHandler
-UserHandler
, but the problem persists.This way I got only 'Listening...' in the output
Another way I tried was
The output was the following:
Any help would be appreciated! Thanks.