'use strict';

const { releaseList } = require('../lib/releaseList');

const listFrontendReleases = async (bot, message) => {
  const releases = await releaseList('ilios', 'frontend');
  bot.reply(message, releases.join(', '));
};

const listCommonReleases = async (bot, message) => {
  const releases = await releaseList('ilios', 'common');
  bot.reply(message, releases.join(', '));
};
const listLtiServerReleases = async (bot, message) => {
  const releases = await releaseList('ilios', 'lti-server');
  bot.reply(message, releases.join(', '));
};

module.exports = bot => {
  bot.hears('frontend releases', 'direct_message,direct_mention,mention', listFrontendReleases);
  bot.hears('common releases', 'direct_message,direct_mention,mention', listCommonReleases);
  bot.hears('lti server releases', 'direct_message,direct_mention,mention', listLtiServerReleases);
};

@@ -74,102 +74,449 @@
 nst 
-listFrontendReleases = async (bot, message) =%3E %7B%0A  const releases = await releaseList('ilios',
+releaseListChooseProject = 'release-list-project';%0A%0Aconst listReleases = async (bot, message) =%3E %7B%0A  bot.reply(message, %7B%0A    text: 'Ok, I will look up a release list for you',%0A    attachments: %5B%0A      %7B%0A        title: 'Which project?',%0A        callback_id: releaseListChooseProject,%0A        attachment_type: 'default',%0A        actions: %5B%0A          %7B%0A            'name': 'frontend',%0A            'text': 'Ilios Frontend',%0A            'value':
  'fr
@@ -526,593 +526,1856 @@
 end'
-);%0A  bot.reply(message, releases.join(', '));%0A%7D;%0A%0Aconst listCommonReleases = async (bot, message) =%3E %7B%0A  const releases = await releaseList('ilios', 'common');%0A  bot.reply(message, releases.join(', '));%0A%7D;%0Aconst listLtiServerReleases = async (bot, message) =%3E %7B%0A  const releases = await releaseList('ilios', 'lti-server');%0A  bot.reply(message, releases.join(', '));%0A%7D;%0A%0Amodule.exports = bot =%3E %7B%0A  bot.hears('frontend releases', 'direct_message,direct_mention,mention', listFrontendReleases);%0A  bot.hears('common releases', 'direct_message,direct_mention,mention', listCommonReleases);
+,%0A            'type': 'button',%0A          %7D,%0A          %7B%0A            'name': 'common',%0A            'text': 'Ilios Common Addon',%0A            'value': 'common',%0A            'type': 'button',%0A          %7D,%0A          %7B%0A            'name': 'lti-server',%0A            'text': 'Ilios LTI Server',%0A            'value': 'lti-server',%0A            'type': 'button',%0A          %7D,%0A          %7B%0A            'name': 'lti-dashboard',%0A            'text': 'Ilios LTI Dashboard',%0A            'value': 'lti-dashboard',%0A            'type': 'button',%0A          %7D,%0A        %5D%0A      %7D%0A    %5D%0A  %7D);%0A%7D;%0A%0Aconst releaseInteraction = async (bot, message) =%3E %7B%0A  const reply = message.original_message;%0A  if (message.callback_id === releaseListChooseProject) %7B%0A    const selection = message.actions%5B0%5D.value;%0A    for (let a = 0; a %3C reply.attachments.length; a++) %7B%0A      reply.attachments%5Ba%5D.actions = null;%0A    %7D%0A    let person = '%3C@' + message.user + '%3E';%0A    if (message.channel%5B0%5D == 'D') %7B%0A      person = 'You';%0A    %7D%0A    const text = person + ' chose ' + selection;%0A    reply.attachments.push(%7B text %7D);%0A%0A    bot.replyInteractive(message, reply, async () =%3E %7B%0A      if (selection === 'frontend') %7B%0A        const releases = await releaseList('ilios', 'frontend');%0A        bot.replyInThread(reply, releases.join(', '));%0A      %7D%0A      if (selection === 'common') %7B%0A        const releases = await releaseList('ilios', 'common');%0A        bot.replyInThread(reply, releases.join(', '));%0A      %7D%0A      if (selection === 'lti-server') %7B%0A        const releases = await releaseList('ilios', 'lti-server');%0A        bot.replyInThread(reply, releases.join(', '));%0A      %7D%0A      if (selection === 'lti-dashboard') %7B%0A        const releases = await releaseList('ilios', 'lti-dashboard');%0A        bot.replyInThread(reply, releases.join(', '));%0A      %7D%0A    %7D);%0A  %7D%0A%7D;%0A%0Amodule.exports = bot =%3E %7B
 %0A  b
@@ -2389,17 +2389,11 @@
 s('l
-ti server
+ist
  rel
@@ -2449,25 +2449,78 @@
 list
-LtiServerReleases
+Releases);%0A  bot.on('interactive_message_callback', releaseInteraction
 );%0A%7D

Make the release list interactive