在 hero Card bot 框架(节点 js)中提及用户
Mention user in heroCard botframework (nodejs)
用户想要 return 向团队频道发送消息。在卡片中,我想提及将消息发回频道的用户。按照说明 on the Microsoft Docs 没有用。使用该 TextEncoder,用户名将被编码并作为数字发送回(例如 82,111,115,105,101,114,115,44,32,74,97,115,112,10,....)。
它的设置方式在 returns 用户名下方,但不是提及,只是文本。我如何将其转换为实际提及用户的代码?
我也试过在 heroCard 中使用 context.activity.from.name
,但也没有提到用户。
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 不支持提及。
但是 Text Messages and Adaptive cards 支持它们,这对我有用。
用户想要 return 向团队频道发送消息。在卡片中,我想提及将消息发回频道的用户。按照说明 on the Microsoft Docs 没有用。使用该 TextEncoder,用户名将被编码并作为数字发送回(例如 82,111,115,105,101,114,115,44,32,74,97,115,112,10,....)。
它的设置方式在 returns 用户名下方,但不是提及,只是文本。我如何将其转换为实际提及用户的代码?
我也试过在 heroCard 中使用 context.activity.from.name
,但也没有提到用户。
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 不支持提及。
但是 Text Messages and Adaptive cards 支持它们,这对我有用。