python - 使用 python 的电报机器人:嵌套对话中无法识别 map_to_parent 状态
问题描述
我的子 convo 不会转移到父 convo。似乎 map_to_parent 中的键没有被识别?它只是在子 convo 结束后停止。我在这里做错了什么?
我也收到此警告:
UserWarning: Handler returned state methodchoiceend which is unknown to the ConversationHandler.
这是一个 mwe:https ://pastebin.com/pnve9gke
解决方案
我在您链接的示例中看到两个问题:
- 两者
method_convo_handler
和count_convo
都用作另一个中的嵌套对话,ConversationHandler
并通过dispatch.add_handler
. 这必然会相互影响。 return METHODCHOICEEND
用于done_method
,而后者又用于count_convo
。count_convo
没有map_to_parent
。
顺便说一句,如果你ConversationHandlers
通过相应的参数给你的名字,你提到的警告将阅读
Handler returned state methodchoiceend which is unknown to the ConversationHandler <name>.
使它更容易调试:)
免责声明:我目前是python-telegram-bot
推荐阅读
- javascript - 在 Vite.js 和 Vue 中使用 socket.io-client
- algorithm - 如何确定嵌套 for 循环的步数?
- python - Python Dataframe 是/否检查器
- rust - 如何将 2D vec 作为切片传递给函数?
- android - 将数据从活动发送到第 3 方活动的对象
- powershell - 在 Powershell Get-ADUser -Filter 中使用变量
- android - 使用服务进行两项活动
- java - 这里有什么问题?学习java
- python - 有什么方法可以检测 python 诅咒中的鼠标移动吗?
- python - 为什么这个门控 SR 锁存器的逻辑不起作用?