manual commit 2026-04-10T19:27:53Z
This commit is contained in:
@@ -874,6 +874,57 @@ async function handleCommand(interaction) {
|
||||
}
|
||||
}
|
||||
|
||||
// /signature
|
||||
if (interaction.commandName === 'signature') {
|
||||
try {
|
||||
await interaction.deferReply({ ephemeral: true });
|
||||
|
||||
// Fetch existing signature data if it exists
|
||||
const StaffSignature = mongoose.model('StaffSignature');
|
||||
const existingSignature = await StaffSignature.findOne({ userId: interaction.user.id }).lean();
|
||||
|
||||
// Create modal
|
||||
const { ModalBuilder, ActionRowBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId(`signature_modal_${interaction.user.id}`)
|
||||
.setTitle('Staff Signature Settings');
|
||||
|
||||
// Add text inputs to modal
|
||||
const valedictionInput = new TextInputBuilder()
|
||||
.setCustomId('valediction')
|
||||
.setLabel('Valediction (e.g. "Best regards", "Thanks")')
|
||||
.setStyle(TextInputStyle.Short)
|
||||
.setRequired(false)
|
||||
.setValue(existingSignature?.valediction || '');
|
||||
|
||||
const displayNameInput = new TextInputBuilder()
|
||||
.setCustomId('display_name')
|
||||
.setLabel('Display Name (e.g. "Support Team")')
|
||||
.setStyle(TextInputStyle.Short)
|
||||
.setRequired(false)
|
||||
.setValue(existingSignature?.displayName || '');
|
||||
|
||||
const taglineInput = new TextInputBuilder()
|
||||
.setCustomId('tagline')
|
||||
.setLabel('Tagline (e.g. "Technical Support Specialist")')
|
||||
.setStyle(TextInputStyle.Short)
|
||||
.setRequired(false)
|
||||
.setValue(existingSignature?.tagline || '');
|
||||
|
||||
const valedictionRow = new ActionRowBuilder().addComponents(valedictionInput);
|
||||
const displayNameRow = new ActionRowBuilder().addComponents(displayNameInput);
|
||||
const taglineRow = new ActionRowBuilder().addComponents(taglineInput);
|
||||
|
||||
modal.addComponents(valedictionRow, displayNameRow, taglineRow);
|
||||
|
||||
await interaction.showModal(modal);
|
||||
} catch (err) {
|
||||
console.error('Signature command error:', err);
|
||||
await interaction.editReply({ content: 'Failed to open signature settings.', ephemeral: true });
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// /accountinfo
|
||||
if (interaction.commandName === 'accountinfo') {
|
||||
await handleAccountInfoCommand(interaction);
|
||||
|
||||
Reference in New Issue
Block a user