mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-05 12:23:09 +02:00
fix: anyone being able to close any ticket
This commit is contained in:
parent
0fcaace8ca
commit
c3ac408733
@ -52,6 +52,19 @@ module.exports = class CloseCommand extends Command {
|
||||
const time = interaction.options.getString(default_i18n('commands.close.options.time.name'));
|
||||
|
||||
if (time) {
|
||||
if (!await this.client.utils.isStaff(interaction.member)) {
|
||||
return await interaction.reply({
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(settings.error_colour)
|
||||
.setTitle(i18n('commands.close.response.no_permission.title'))
|
||||
.setDescription(i18n('commands.close.response.no_permission.description'))
|
||||
.setFooter(settings.footer, interaction.guild.iconURL())
|
||||
],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
let period;
|
||||
try {
|
||||
period = ms(time);
|
||||
@ -176,7 +189,6 @@ module.exports = class CloseCommand extends Command {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
||||
let t_row;
|
||||
if (ticket) {
|
||||
t_row = await this.client.tickets.resolve(ticket, interaction.guild.id);
|
||||
@ -208,6 +220,19 @@ module.exports = class CloseCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
if (t_row.creator !== interaction.member.id && !await this.client.utils.isStaff(interaction.member)) {
|
||||
return await interaction.reply({
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
.setColor(settings.error_colour)
|
||||
.setTitle(i18n('commands.close.response.no_permission.title'))
|
||||
.setDescription(i18n('commands.close.response.no_permission.description'))
|
||||
.setFooter(settings.footer, interaction.guild.iconURL())
|
||||
],
|
||||
ephemeral: true
|
||||
});
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
components: [
|
||||
new MessageActionRow()
|
||||
|
@ -179,6 +179,10 @@
|
||||
"description": "The time period provided could not be parsed.",
|
||||
"title": "❌ Invalid input"
|
||||
},
|
||||
"no_permission": {
|
||||
"description": "You are not a staff member or the ticket creator.",
|
||||
"title": "❌ Insufficient permission"
|
||||
},
|
||||
"no_tickets": {
|
||||
"description": "There are no tickets which have been inactive for this time period.",
|
||||
"title": "❌ No tickets to close"
|
||||
|
Loading…
Reference in New Issue
Block a user