mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 08:13: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'));
|
const time = interaction.options.getString(default_i18n('commands.close.options.time.name'));
|
||||||
|
|
||||||
if (time) {
|
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;
|
let period;
|
||||||
try {
|
try {
|
||||||
period = ms(time);
|
period = ms(time);
|
||||||
@ -176,7 +189,6 @@ module.exports = class CloseCommand extends Command {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
let t_row;
|
let t_row;
|
||||||
if (ticket) {
|
if (ticket) {
|
||||||
t_row = await this.client.tickets.resolve(ticket, interaction.guild.id);
|
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({
|
await interaction.reply({
|
||||||
components: [
|
components: [
|
||||||
new MessageActionRow()
|
new MessageActionRow()
|
||||||
|
@ -179,6 +179,10 @@
|
|||||||
"description": "The time period provided could not be parsed.",
|
"description": "The time period provided could not be parsed.",
|
||||||
"title": "❌ Invalid input"
|
"title": "❌ Invalid input"
|
||||||
},
|
},
|
||||||
|
"no_permission": {
|
||||||
|
"description": "You are not a staff member or the ticket creator.",
|
||||||
|
"title": "❌ Insufficient permission"
|
||||||
|
},
|
||||||
"no_tickets": {
|
"no_tickets": {
|
||||||
"description": "There are no tickets which have been inactive for this time period.",
|
"description": "There are no tickets which have been inactive for this time period.",
|
||||||
"title": "❌ No tickets to close"
|
"title": "❌ No tickets to close"
|
||||||
|
Loading…
Reference in New Issue
Block a user