Change private help ticket cooldown
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import { ActionRowBuilder, ButtonInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags, ChannelType, PermissionFlagsBits, ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
import { ticketCooldownMap } from '../shared/ticket-cooldown';
|
||||
import { Database } from '../shared/Database';
|
||||
|
||||
export default {
|
||||
@@ -19,7 +18,7 @@ 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.' });
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to claim ticket.' });
|
||||
|
||||
const closeButton = new ButtonBuilder()
|
||||
.setCustomId('close-ticket')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ActionRowBuilder, ButtonInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags, ChannelType, ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
import { ticketCooldownMap } from '../shared/ticket-cooldown';
|
||||
import { Database } from '../shared/Database';
|
||||
|
||||
export default {
|
||||
name: 'close-ticket',
|
||||
@@ -14,6 +14,8 @@ export default {
|
||||
components: []
|
||||
});
|
||||
|
||||
await Database.closePrivateHelpTicket(channel.id);
|
||||
|
||||
await channel.send(`This ticket has been closed by ${interaction.user}`);
|
||||
|
||||
await interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Ticket closed.' });
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ActionRowBuilder, ButtonInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags } from 'discord.js';
|
||||
import { ticketCooldownMap } from '../shared/ticket-cooldown';
|
||||
import { Database } from '../shared/Database';
|
||||
|
||||
export default {
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { ActionRowBuilder, ButtonInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags } from 'discord.js';
|
||||
import { ticketCooldownMap } from '../shared/ticket-cooldown';
|
||||
import { canOpenPrivateHelpTicket } from '../utils';
|
||||
|
||||
export default {
|
||||
name: 'private-help',
|
||||
handler: async function (client: Client, interaction: ButtonInteraction) {
|
||||
const allowedAt = ticketCooldownMap.get(interaction.user.id);
|
||||
|
||||
if (allowedAt && Date.now() < allowedAt)
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'You can only create one ticket per day.' });
|
||||
if (!(await canOpenPrivateHelpTicket(interaction.user.id)))
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'You can only have one open ticket at a time that is less than a day old.' });
|
||||
|
||||
const modal = new ModalBuilder()
|
||||
.setCustomId('open-ticket-modal')
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ActionRowBuilder, ButtonInteraction, Client, ModalBuilder, TextInputBuilder, TextInputStyle, MessageFlags, ChannelType, PermissionFlagsBits, ButtonBuilder, ButtonStyle } from 'discord.js';
|
||||
import { ticketCooldownMap } from '../shared/ticket-cooldown';
|
||||
import { Database } from '../shared/Database';
|
||||
|
||||
export default {
|
||||
@@ -21,7 +20,7 @@ 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.' });
|
||||
return interaction.reply({ flags: [MessageFlags.Ephemeral], content: 'Failed to unclaim ticket.' });
|
||||
|
||||
const closeButton = new ButtonBuilder()
|
||||
.setCustomId('close-ticket')
|
||||
|
||||
Reference in New Issue
Block a user