我有一个斜杠命令,当调用它时,会打印一个团队列表(存储在列表中),旁边有复选框。我可以在旁边创建带有团队名称的复选框,但前提是团队名称是硬编码的。如何遍历列表并创建未知数量的复选框?
app.command("/message", (req, ctx) -> {
ctx.respond(res -> res
.responseType("in_channel") // or "in_channnel"
.blocks(asBlocks(
section(section -> section.text(markdownText("Select channels to receive message")).accessory(
checkboxes(checkboxes -> checkboxes
.options(asOptions(
option(option -> option.value("0").text(markdownText("some-team")))
option(option -> option.value("1").text(markdownText("another-team")))
))
)
)),
actions(actions -> actions
.elements(asElements(
button(b -> b.actionId("submit").text(plainText
(pt -> pt.emoji(true).text("Submit"))).style("primary").value("submit"))
))
)
))
);
return ctx.ack();
});