From af11904359b05ffb284221721e6a10f856d7868b Mon Sep 17 00:00:00 2001 From: "Isaac (eartharoid)" Date: Mon, 5 Oct 2020 23:11:55 +0100 Subject: [PATCH] Update close.js Fix permission issue. Previously anyone added to a ticket could close it, whereas the expected functionality was that owner the creator or staff could close it. Thanks @iFusionFr for reporting the issue. --- src/commands/close.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/commands/close.js b/src/commands/close.js index 8e1116b..f63d5bf 100644 --- a/src/commands/close.js +++ b/src/commands/close.js @@ -59,19 +59,20 @@ module.exports = { return message.channel.send(notTicket); } - if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role)) - return message.channel.send( - new MessageEmbed() - .setColor(config.err_colour) - .setAuthor(message.author.username, message.author.displayAvatarURL()) - .setTitle(':x: **No permission**') - .setDescription(`You don't have permission to close ${channel} as it does not belong to you and you are not staff.`) - .addField('Usage', `\`${config.prefix}${this.name} ${this.usage}\`\n`) - .addField('Help', `Type \`${config.prefix}help ${this.name}\` for more information`) - .setFooter(guild.name, guild.iconURL()) - ); } + if (message.author.id !== ticket.creator && !message.member.roles.cache.has(config.staff_role)) + return message.channel.send( + new MessageEmbed() + .setColor(config.err_colour) + .setAuthor(message.author.username, message.author.displayAvatarURL()) + .setTitle(':x: **No permission**') + .setDescription(`You don't have permission to close ${channel} as it does not belong to you and you are not staff.`) + .addField('Usage', `\`${config.prefix}${this.name} ${this.usage}\`\n`) + .addField('Help', `Type \`${config.prefix}help ${this.name}\` for more information`) + .setFooter(guild.name, guild.iconURL()) + ); + let success; let pre = fs.existsSync(`user/transcripts/text/${channel.id}.txt`) || fs.existsSync(`user/transcripts/raw/${channel.id}.log`) ?