Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FirezTheGreat committed Oct 23, 2022
1 parent 05dac7c commit d5d4e97
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion events/client/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ module.exports = class interactionCreate extends Event {
if (interaction.member.permissions.has(PermissionFlagsBits.BanMembers) || interaction.member.id === player.id) {
await interaction.deferReply();

const ticket_index = player.tickets.findIndex(({ id }) => id === player.id);
const ticket_index = player.tickets.findIndex(({ channel_id }) => channel_id === interaction.channelId);

player.tickets[ticket_index].active = false;
player.tickets[ticket_index].ended_timestamp = Date.now();
Expand All @@ -196,6 +196,8 @@ module.exports = class interactionCreate extends Event {
);

await interaction.editReply({ content: `*${interaction.channel} will be deleted in 5 seconds..*` });

setTimeout(() => interaction.channel.delete().catch(() => null), 5000);
} else {
await interaction.reply({ content: '*You do not have permission to close this ticket.*', ephemeral: true });
};
Expand Down

0 comments on commit d5d4e97

Please sign in to comment.