BotKit + Slack Adapter - Как удалить разговор, когда он заканчивается? - PullRequest
0 голосов
/ 08 октября 2019

У меня есть следующая программа, но я не могу понять, как удалить кнопки или, желательно, целое сообщение после того, как пользователь нажал одну из кнопок?

  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)
...