具有单个callback_id的多个附件:松弛的交互式组件 [英] Multiple attachment with single callback_id: slack interactive component
问题描述
是否可以具有多个菜单附件,并允许用户在发送回整理后的响应之前选择每个菜单?
Is it possible to have multiple menu attachment and allow users to select each menu before sending back the collated response?
return Promise.resolve({
text: `Rate each game`,
attachments: [
...games.map(game => ({
color: "#5A352D",
title: game,
callback_id: "game:done",
actions: [
{
name: "done",
text: "Select a score",
type: "select",
value: "game:done",
options: [
{ text: 1, value: 1 },
{ text: 2, value: 2 }
]
}
]
}))
]
});
此图片显示了其渲染方式 但是,只有在用户完成每个游戏的得分后,我才需要调用回调.
This images shows how it renders But, I need to call the callback only when the user has finished scoring each game.
也许我可以为此提供一个附加按钮,但是如何处理这些菜单操作的回调
Perhaps, I can provide an additional button for that, but how can I handle callback for these menu actions
推荐答案
选择菜单选项将始终向您的应用触发请求.但是您可以替换前面的消息并每次重新创建菜单列表,并向用户显示其余菜单,直到全部选中为止.从技术上讲,每次都会是一条新消息,但是通过替换旧消息,用户将不会注意到.
Choosing a menu option will always fire a request to your app. But you could replace the former message and recreate the menu list each time and show the remaining menus to the user until all are chosen. Technically it will be a new message each time, but by replacing the old message the user will not notice.
这篇关于具有单个callback_id的多个附件:松弛的交互式组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!