BotKit + Slack适配器-对话结束后如何删除?

时间:2019-10-08 08:11:37

标签: slack slack-api botkit

我有以下程序,但是在用户单击其中一个按钮后,无法弄清楚如何删除按钮,或者最好删除整个消息?

  const dialog = new BotkitConversation(BLIND_UPDOWN_DIALOG, controller)

  dialog.addQuestion(
    {
      text: 'What did you want to do?',
      action: 'complete',
      blocks: async (template, vars) => {
        return [
          {
            type: 'section',
            text: {
              type: 'plain_text',
              text: 'What did you want to do?',
            },
          },
          {
            type: 'actions',
            elements: [
              {
                type: 'button',
                text: {
                  type: 'plain_text',
                  text: '⬆️ Raise blinds',
                },
                value: 'up',
              },
              {
                type: 'button',
                text: {
                  type: 'plain_text',
                  text: '⬇️ Lower blinds',
                },
                value: 'down',
              },
              {
                type: 'button',
                text: {
                  type: 'plain_text',
                  text: '❌ Cancel',
                },
                value: 'cancel',
              },
            ],
          },
        ]
      },
    },
    async (response, convo, bot, b) => {
      console.log('response', convo, b)
      await bot.say('Oh your response is ' + response)
    },
    'blindCommand'
  )

  controller.addDialog(dialog)

0 个答案:

没有答案