Skip to content

Commit

Permalink
Allow selecting multiple technologies when requesting mentor help
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-panhead committed Nov 27, 2024
1 parent 4ba475e commit c4ed7a1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions commands/a_start_commands/start-mentor-cave.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ function makeSelectMenuRow() {
new MessageSelectMenu()
.setCustomId('ticketType')
.addOptions(options)
.setMinValues(1)
.setMaxValues(10)
);
return selectMenuRow;
}
Expand Down Expand Up @@ -634,7 +636,10 @@ function listenToRequestConsole(
});

if (submitted) {
const role = i.values[0] === 'None of the above' ? initBotInfo.roleIDs.mentorRole : guild.roles.cache.find(role => role.name.toLowerCase() === `M-${i.values[0]}`.toLowerCase()).id;
const roles = i.values.map((value) => value === 'None of the above' ?
initBotInfo.roleIDs.mentorRole :
guild.roles.cache.find(role => role.name.toLowerCase() === `M-${value}`.toLowerCase()).id
);
const description = submitted.fields.getTextInputValue('ticketDescription');
const location = submitted.fields.getTextInputValue('location');
// const helpFormat = submitted.fields.getTextInputValue('helpFormat');
Expand Down Expand Up @@ -671,11 +676,12 @@ function listenToRequestConsole(
// .setLabel('Accept ticket (online) - Only use if hackers are OK with it!')
// .setStyle('PRIMARY'),
// );
const rolesString = roles.map(role => `<@&${role}>`).join(', ');

const ticketMsg = await incomingTicketsChannel.send({ content: '<@&' + role + '>, requested by <@' + submitted.user.id + '>', embeds: [newTicketEmbed], components: [ticketAcceptanceRow] });
const ticketMsg = await incomingTicketsChannel.send({ content: rolesString + ', requested by <@' + submitted.user.id + '>', embeds: [newTicketEmbed], components: [ticketAcceptanceRow] });
submitted.reply({ content: 'Your ticket has been submitted!', ephemeral: true });
const ticketReminder = setTimeout(() => {
ticketMsg.reply('<@&' + role + '> ticket ' + ticketNumber + ' still needs help!');
ticketMsg.reply(rolesString + ' ticket ' + ticketNumber + ' still needs help!');
}, reminderTime * 60000);

const confirmationEmbed = new MessageEmbed()
Expand Down

0 comments on commit c4ed7a1

Please sign in to comment.