fix: only send value if not empty (closes #458)

This commit is contained in:
Isaac
2024-01-20 21:08:51 +00:00
parent e695aa2147
commit bcd02b1dea
2 changed files with 31 additions and 35 deletions

View File

@@ -285,18 +285,16 @@ module.exports = class TicketManager {
.filter(q => q.type === 'TEXT') // TODO: remove this when modals support select menus
.map(q => {
if (q.type === 'TEXT') {
return new ActionRowBuilder()
.setComponents(
new TextInputBuilder()
.setCustomId(q.id)
.setLabel(q.label)
.setStyle(q.style)
.setMaxLength(Math.min(q.maxLength, 1000))
.setMinLength(q.minLength)
.setPlaceholder(q.placeholder)
.setRequired(q.required)
.setValue(q.value),
);
const field = new TextInputBuilder()
.setCustomId(q.id)
.setLabel(q.label)
.setStyle(q.style)
.setMaxLength(Math.min(q.maxLength, 1000))
.setMinLength(q.minLength)
.setPlaceholder(q.placeholder)
.setRequired(q.required);
if (q.value) field.setValue(q.value);
return new ActionRowBuilder().setComponents(field);
} else if (q.type === 'MENU') {
return new ActionRowBuilder()
.setComponents(