Compare commits

..

No commits in common. "54ba45defd2b3ab00b830c0ab3925dc38551a0f3" and "bbe894a66f03a044c9b8ab3013a1a11611e4a1de" have entirely different histories.

2 changed files with 1 additions and 19 deletions

View file

@ -1,5 +1,5 @@
import { SlashCommandBuilder } from '@discordjs/builders';
import { Permissions } from 'discord.js';
export default {
data: new SlashCommandBuilder()
.setName('fakeuser')
@ -16,7 +16,6 @@ export default {
option.setName('image')
.setDescription('Optional attachment.')
.setRequired(false)),
clientPermissions: [ Permissions.FLAGS.MANAGE_WEBHOOKS ],
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const attachment = interaction.options.getAttachment('image');

View file

@ -1,4 +1,3 @@
import { Permissions } from 'discord.js';
import db from '../../models/index.js';
const ratelimit = {};
@ -31,26 +30,10 @@ export default {
console.log(`\x1b[33m${userTag} (${userID})\x1b[0m launched command \x1b[33m${commandName}\x1b[0m`);
// Owner only check
if (command.ownerOnly && interaction.user.id !== ownerId) {
return interaction.reply({ content: '❌ This command is reserved for the owner!', ephemeral: true });
}
// Check if the bot has the needed permissions
if (command.clientPermissions) {
const clientMember = await interaction.guild.members.fetch(client.user.id);
if (!clientMember.permissions.has(command.clientPermissions)) {
return interaction.reply({ content: `❌ I am missing one of the following permission(s): \`${new Permissions(command.clientPermissions).toArray()}\``, ephemeral: true });
}
}
// Check if the user has the needed permissions
if (command.userPermissions) {
if (!interaction.member.permissions.has(command.userPermissions)) {
return interaction.reply({ content: `❌ You are missing one of the following permission(s): \`${new Permissions(command.userPermissions).toArray()}\``, ephemeral: true });
}
}
try {
const date = new Date();
if (ratelimit[userID]) {