我知道,即使我无法使MarkCard的HeroCard“文本”字段值受支持(在MSTeams上测试):
码
this.bot.dialog("sendCard", (session, args, next) => {
session.sendTyping();
const card = new builder.HeroCard(session);
card.title("Title");
card.subtitle("Subtitle");
card.text("This is some *mardown* text! \n\n - one \n\n - two");
const msg = new builder.Message(session);
msg.textFormat("markdown");
msg.attachments([
card,
]);
session.endDialog(msg);
});
Run Code Online (Sandbox Code Playgroud)
我想知道如何实现这种格式(来自MSTeams中的mailclark bot):
如您所见,它是我认为可能是HeroCard的轮播,但是它们在新段落中以粗体,代码和无序列表进行了格式化。
邮件附件不接受格式化似乎是一个已知问题,但是mailclark伙计们怎么能做到这一点?
由于英雄卡最终将转换为富卡从机器人发送给用户,并从https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/bots/bots-conversations#formatting-文本内容:
Microsoft Teams 支持 Markdown 和 XML (HTML) 格式标记的子集。
富卡不支持 Markdown 或表格格式
因此,在 MS Teams 频道中,仅在纯文本消息中支持 Markdown 格式,但是,我们可以利用HTMLRich Card 中的标签。
请考虑以下代码片段:
bot.dialog('/', function (session) {
const card = new builder.HeroCard(session);
card.title("Type your question to our support team here");
card.subtitle("Or, click the ?? arrows for a series of how-tos");
card.images([builder.CardImage.create(session,"<image url>")])
card.text("<p>This is some <i>mardown</i> <b>text</b>!</p> <ul><li><b>one</b></li><li><code>two</code></li></ul>")
const msg = new builder.Message(session);
msg.attachmentLayout(builder.AttachmentLayout.carousel);
msg.attachments([
card,card,card
]).toMessage();
session.send(msg);
session.endDialog("This is some *mardown* **text**! \n\n - **one** \n\n - `two`");
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
669 次 |
| 最近记录: |