单击 Card Action - Bot Framework 时如何调用特定回调

How to call a specifc callback when clicking in Card Action - Bot Framework

我正在展示一个轮播,其中包含一些产品,每个产品中都有一个带有代码的按钮。 Card Action Type 是 'ImBack',但是一旦通过 postAsync 方法显示轮播,单击按钮将再次调用根对话框。

有没有办法为按钮点击定义回调或显示相同的旋转木马但使用 PromptDialog?

无法在卡片操作按钮上定义回调。当Card Action定义为ImBack时,点击后;它基本上会 post 向机器人发送一条消息,因此它将由您在 post 轮播后调用 context.Wait 时定义的方法处理。

这里的方法是使用另一种方法(与您的 MessageReceivedAsync 不同),只是为了保持代码整洁,然后对该方法执行 context.Wait。然后在该方法上,您基本上必须根据机器人收到的消息(这将是卡片操作的价值)决定要做什么。

ContosoFlowers sample you will find an example of this. See the ContosoFlowersCategoriesDialog and the PagedCarouselDialog.