eva
eva

Reputation: 57

telegram bot with python: map_to_parent state is not recognized in nested conversation

My child convo does not transfer to the parent convo. Seems like the key in map_to_parent isnt being recognized? it just stops after the child convo ends. What am I doing wrong here?

Im also getting this warning:

UserWarning: Handler returned state methodchoiceend which is unknown to the ConversationHandler.

Here is an mwe: https://pastebin.com/pnve9gke

Upvotes: 0

Views: 1289

Answers (1)

CallMeStag
CallMeStag

Reputation: 7050

I see two problems in the example that you linked:

  1. Both method_convo_handler and count_convo are both used as a nested conversation within another ConversationHandler and added directly via dispatch.add_handler. This is bound to interefer.
  2. return METHODCHOICEEND is used in done_method, which in turn is used in count_convo. count_convo doesn't have map_to_parent.

BTW, if you give your ConversationHandlers a name via the corresponding argument, the waring that you mentioned will read

Handler returned state methodchoiceend which is unknown to the ConversationHandler <name>.

making it a bit easier to debug :)


Disclaimer: I'm currently the maintainer of python-telegram-bot

Upvotes: 1

Related Questions