Ticket unclaiming
This commit is contained in:
@@ -8,7 +8,7 @@ export default {
|
||||
const channel = await interaction.channel?.fetch();
|
||||
|
||||
if (!channel || !channel.isThread() || !channel.isSendable() || channel.type != ChannelType.PrivateThread)
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong. Please report this to a staff member.' });
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Oops. Something went wrong.' });
|
||||
|
||||
if (!interaction.memberPermissions) return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'An error has occurred.' });
|
||||
|
||||
@@ -19,28 +19,23 @@ export default {
|
||||
const guildSettings = await Database.getGuildSettings(guild.id);
|
||||
|
||||
if (!guildSettings || !guildSettings.private_help_role_id)
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to create ticket. Please report this to a staff member.' });
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to create ticket.' });
|
||||
|
||||
const closeButton = new ButtonBuilder()
|
||||
.setCustomId('close-ticket')
|
||||
.setLabel('Click here if you no longer need help')
|
||||
.setStyle(ButtonStyle.Danger);
|
||||
|
||||
const claimButton = new ButtonBuilder()
|
||||
.setCustomId('claim-ticket')
|
||||
.setLabel('Claim ticket')
|
||||
.setDisabled(true)
|
||||
const unclaimButton = new ButtonBuilder()
|
||||
.setCustomId('unclaim-ticket')
|
||||
.setLabel('Unclaim ticket')
|
||||
.setStyle(ButtonStyle.Primary);
|
||||
|
||||
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(closeButton, claimButton);
|
||||
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(closeButton, unclaimButton);
|
||||
|
||||
await interaction.message.edit({
|
||||
content: `${interaction.message.content}\n\nClaimed by: ${interaction.user}`,
|
||||
components: [row],
|
||||
allowedMentions: {
|
||||
users: [interaction.user.id],
|
||||
roles: [guildSettings.private_help_role_id]
|
||||
}
|
||||
components: [row]
|
||||
});
|
||||
|
||||
await interaction.reply({ content: `Ticket claimed by ${interaction.user}.` });
|
||||
|
||||
Reference in New Issue
Block a user