mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-06 18:21:25 +03:00
fix: check roles for staff-only commands
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const { SlashCommand } = require('@eartharoid/dbf');
|
||||
const { ApplicationCommandOptionType } = require('discord.js');
|
||||
const ExtendedEmbedBuilder = require('../../lib/embed');
|
||||
const { isStaff } = require('../../lib/users');
|
||||
|
||||
module.exports = class MoveSlashCommand extends SlashCommand {
|
||||
constructor(client, options) {
|
||||
@@ -62,10 +63,25 @@ module.exports = class MoveSlashCommand extends SlashCommand {
|
||||
});
|
||||
}
|
||||
|
||||
const getMessage = client.i18n.getLocale(ticket.guild.locale);
|
||||
|
||||
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new ExtendedEmbedBuilder({
|
||||
iconURL: interaction.guild.iconURL(),
|
||||
text: ticket.guild.footer,
|
||||
})
|
||||
.setColor(ticket.guild.errorColour)
|
||||
.setTitle(getMessage('commands.slash.move.not_staff.title'))
|
||||
.setDescription(getMessage('commands.slash.move.not_staff.description')),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
const creator = await interaction.guild.members.fetch(ticket.createdById);
|
||||
const newCategory = await client.prisma.category.findUnique({ where: { id: interaction.options.getInteger('category', true) } });
|
||||
const discordCategory = await interaction.guild.channels.fetch(newCategory.discordCategory);
|
||||
const getMessage = client.i18n.getLocale(ticket.guild.locale);
|
||||
|
||||
if (discordCategory.children.cache.size === 50) {
|
||||
return await interaction.editReply({
|
||||
|
@@ -2,6 +2,7 @@ const { SlashCommand } = require('@eartharoid/dbf');
|
||||
const { ApplicationCommandOptionType } = require('discord.js');
|
||||
const ExtendedEmbedBuilder = require('../../lib/embed');
|
||||
const { logTicketEvent } = require('../../lib/logging');
|
||||
const { isStaff } = require('../../lib/users');
|
||||
|
||||
module.exports = class PrioritySlashCommand extends SlashCommand {
|
||||
constructor(client, options) {
|
||||
@@ -86,6 +87,20 @@ module.exports = class PrioritySlashCommand extends SlashCommand {
|
||||
});
|
||||
}
|
||||
|
||||
if (!(await isStaff(interaction.guild, interaction.user.id))) { // if user is not staff
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new ExtendedEmbedBuilder({
|
||||
iconURL: interaction.guild.iconURL(),
|
||||
text: ticket.guild.footer,
|
||||
})
|
||||
.setColor(ticket.guild.errorColour)
|
||||
.setTitle(getMessage('commands.slash.move.not_staff.title'))
|
||||
.setDescription(getMessage('commands.slash.move.not_staff.description')),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
const priority = interaction.options.getString('priority', true);
|
||||
let name = interaction.channel.name;
|
||||
if (ticket.priority) name = name.replace(this.getEmoji(ticket.priority), this.getEmoji(priority));
|
||||
|
Reference in New Issue
Block a user