自适应卡值在提交后不会持续存在

时间:2019-06-20 14:29:14

标签: javascript botframework microsoft-teams adaptive-cards

说我有一个Teams Bot,它用带有输入元素(例如Input.Text)的自适应卡做出响应(尽管我在任何输入元素中都看到了这种行为)。在Teams中运行时,在用户键入内容并提交后,我看到自适应卡清除了文本。有没有一种方法可以使文本不被清除而只保留用户键入的内容?

const { ActivityHandler, CardFactory } = require('botbuilder');
const InputCard = require('../resources/InputCard.json');

class TestBot extends ActivityHandler {
    constructor(userState) {
        super();
        this.userState = userState;
        this.onMembersAdded(async (context, next) => {
            await next();
        });
        this.onMessage(async (context, next) => {
            await context.sendActivity({
                attachments: [CardFactory.adaptiveCard(InputCard)]
            });
            await this.userState.saveChanges(context);
            await next();
        });
    }
}

module.exports.TestBot = TestBot;
{
  "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
  "type": "AdaptiveCard",
  "version": "1.0",
  "body": [
    {
      "type": "Input.Text",
      "id": "message"
    }
  ],
  "actions": [
    {
      "type": "Action.Submit",
      "title": "OK"
    }
  ]
}

0 个答案:

没有答案