node.js - 在 heroCard botframework (nodejs) 中提及用户
问题描述
用户想要将消息返回到团队频道。在卡片中,我想提及将消息发送回频道的用户。按照Microsoft Docs 上的说明操作无效。使用该 TextEncoder,用户的姓名将被编码并作为数字返回(例如 82,111,115,105,101,114,115,44,32,74,97,115,112,10,....)。
下面的设置方式返回用户名,但不作为提及,只是文本。如何将其转换为实际提及用户的代码?
我也尝试context.activity.from.name
在 heroCard 中使用,但也没有提及用户。
const mention = {
mentioned: context.activity.from,
text: `<at>${context.activity.from.name}</at>`,
type: 'mention'
} as Mention;
const heroCard = CardFactory.heroCard(
`Returned question by ${ mention.mentioned.name }`,
`${ mention.mentioned.name } You can internally discuss the user request below. ` +
'Once ready, one person can take ownership of the conversation with the user by pressing the button. ' +
'The user\'s question: ' + teamsSupport.question,
null,
CardFactory.actions([
{
title: 'Takeover conversation',
type: ActionTypes.MessageBack,
displayText: `I will take this conversation.`,
text: this.configService.get<string>('TakeoverConfirmation') + teamsSupport.sessionId,
value: ''
},
{
title: 'Show chat history',
type: ActionTypes.OpenUrl,
value: 'https://****/conversations/' + teamsSupport.sessionId
}
])
);
const suggestedActions = MessageFactory.attachment(heroCard);
suggestedActions.entities = [mention];
解决方案
正如Wajeed-MSFT正确指出的那样,heroCards 不支持提及。
推荐阅读
- python - PyCharm 您的终端不支持光标位置请求 (CPR)
- excel - 如何根据按钮位置获取 wb.sheetname 和 wb.name?
- xamarin.android - 如何在 xamarin 表单应用程序中获取网站的 IP 地址?
- firebase - 如何在 Unity 中链接/合并两个 Firebase 帐户?
- wordpress - Pagespeed 和 GtMatrix 试图搜索很久但能够得到解决
- javascript - 我有一个关于 JavaScript 类型的简单问题
- excel - 是否有原因仅在包含“MsgBox(休息日)”时才起作用?
- c# - 安装 Android Support Library v7 Appcompat 会导致 Visual Studio 2019 出现错误
- api - Google My Business API 位置列表请求未返回所有位置
- css - 响应式布局,需要支持